1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-23 10:19:48 +01: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;
};
};
};
}