diff options
author | Anders Lundstedt <git@anderslundstedt.se> | 2019-07-19 22:13:06 +0200 |
---|---|---|
committer | Anders Lundstedt <git@anderslundstedt.se> | 2019-07-21 00:58:20 +0200 |
commit | 53841fcea9cbd639dfd30714e48959a9752c5818 (patch) | |
tree | 9846d39dd30e27e07a28261760b77f047ede3e9c /nixos/modules/services | |
parent | e6dd87c438ede050a78b7eeb1539be1af03f4479 (diff) | |
download | nixlib-53841fcea9cbd639dfd30714e48959a9752c5818.tar nixlib-53841fcea9cbd639dfd30714e48959a9752c5818.tar.gz nixlib-53841fcea9cbd639dfd30714e48959a9752c5818.tar.bz2 nixlib-53841fcea9cbd639dfd30714e48959a9752c5818.tar.lz nixlib-53841fcea9cbd639dfd30714e48959a9752c5818.tar.xz nixlib-53841fcea9cbd639dfd30714e48959a9752c5818.tar.zst nixlib-53841fcea9cbd639dfd30714e48959a9752c5818.zip |
nixos/spotifyd: init
Diffstat (limited to 'nixos/modules/services')
-rw-r--r-- | nixos/modules/services/audio/spotifyd.nix | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/nixos/modules/services/audio/spotifyd.nix b/nixos/modules/services/audio/spotifyd.nix new file mode 100644 index 000000000000..e3556b2559c2 --- /dev/null +++ b/nixos/modules/services/audio/spotifyd.nix @@ -0,0 +1,42 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.spotifyd; + spotifydConf = pkgs.writeText "spotifyd.conf" cfg.config; +in +{ + options = { + services.spotifyd = { + enable = mkEnableOption "spotifyd, a Spotify playing daemon"; + + config = mkOption { + default = ""; + type = types.lines; + description = '' + Configuration for Spotifyd. For syntax and directives, see + https://github.com/Spotifyd/spotifyd#Configuration. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + systemd.services.spotifyd = { + wantedBy = [ "multi-user.target" ]; + after = [ "network-online.target" "sound.target" ]; + description = "spotifyd, a Spotify playing daemon"; + serviceConfig = { + ExecStart = "${pkgs.spotifyd}/bin/spotifyd --no-daemon --cache_path /var/cache/spotifyd --config ${spotifydConf}"; + Restart = "always"; + RestartSec = 12; + DynamicUser = true; + CacheDirectory = "spotifyd"; + SupplementaryGroups = ["audio"]; + }; + }; + }; + + meta.maintainers = [ maintainers.anderslundstedt ]; +} |