about summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2019-07-24 00:54:24 +0200
committerGitHub <noreply@github.com>2019-07-24 00:54:24 +0200
commit101a4be5a77bd6ee7af655bbc565efd43bb3a1e7 (patch)
tree05c555858f2a369ec3e78ad3148fbcac0d1ffa14 /nixos/modules/services
parent471ff05140c4b5fc8ff2777753671cc6b95dd49e (diff)
parent53841fcea9cbd639dfd30714e48959a9752c5818 (diff)
downloadnixlib-101a4be5a77bd6ee7af655bbc565efd43bb3a1e7.tar
nixlib-101a4be5a77bd6ee7af655bbc565efd43bb3a1e7.tar.gz
nixlib-101a4be5a77bd6ee7af655bbc565efd43bb3a1e7.tar.bz2
nixlib-101a4be5a77bd6ee7af655bbc565efd43bb3a1e7.tar.lz
nixlib-101a4be5a77bd6ee7af655bbc565efd43bb3a1e7.tar.xz
nixlib-101a4be5a77bd6ee7af655bbc565efd43bb3a1e7.tar.zst
nixlib-101a4be5a77bd6ee7af655bbc565efd43bb3a1e7.zip
Add spotifyd package and service (#65092)
Add spotifyd package and service
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/audio/spotifyd.nix42
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 ];
+}