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:
parent
b1dd373f5a
commit
eee6ae33e8
3 changed files with 62 additions and 0 deletions
|
@ -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'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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 { })
|
||||
|
|
53
modules/services/spotifyd.nix
Normal file
53
modules/services/spotifyd.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue