1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-26 00:18:30 +02:00

spotifyd: add module

This commit is contained in:
Kloenk 2019-10-18 21:04:08 +02:00 committed by Robert Helgesson
parent b1dd373f5a
commit eee6ae33e8
No known key found for this signature in database
GPG Key ID: 36BDAA14C2797E89
3 changed files with 62 additions and 0 deletions

View File

@ -1236,6 +1236,14 @@ in
A new module is available: 'services.lorri'.
'';
}
{
time = "2019-11-24T17:46:57+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.spotifyd'.
'';
}
];
};
}

View File

@ -132,6 +132,7 @@ let
(loadModule ./services/screen-locker.nix { })
(loadModule ./services/stalonetray.nix { })
(loadModule ./services/status-notifier-watcher.nix { })
(loadModule ./services/spotifyd.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/sxhkd.nix { condition = hostPlatform.isLinux; })
(loadModule ./services/syncthing.nix { })
(loadModule ./services/taffybar.nix { })

View File

@ -0,0 +1,53 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.spotifyd;
configFile = pkgs.writeText "spotifyd.conf" ''
${generators.toINI {} cfg.settings}
'';
in
{
options.services.spotifyd = {
enable = mkEnableOption "SpotifyD connect";
settings = mkOption {
type = types.attrsOf (types.attrsOf types.str);
default = {};
description = "Configuration for spotifyd";
example = literalExample ''
{
global = {
user = "Alex";
password = "foo";
device_name = "nix";
};
}
'';
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.spotifyd ];
systemd.user.services.spotifyd = {
Unit = {
Description = "spotify daemon";
Documentation = "https://github.com/Spotifyd/spotifyd";
};
Install.WantedBy = [ "default.target" ];
Service = {
ExecStart = "${pkgs.spotifyd}/bin/spotifyd --no-daemon --config ${configFile}";
Restart = "always";
RestartSec = 12;
};
};
};
}