aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/nixos/modules/services/audio/spotifyd.nix
diff options
context:
space:
mode:
Diffstat (limited to 'infra/libkookie/nixpkgs/nixos/modules/services/audio/spotifyd.nix')
-rw-r--r--infra/libkookie/nixpkgs/nixos/modules/services/audio/spotifyd.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/nixos/modules/services/audio/spotifyd.nix b/infra/libkookie/nixpkgs/nixos/modules/services/audio/spotifyd.nix
new file mode 100644
index 000000000000..a589153248fe
--- /dev/null
+++ b/infra/libkookie/nixpkgs/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
+ <link xlink:href="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-path ${spotifydConf}";
+ Restart = "always";
+ RestartSec = 12;
+ DynamicUser = true;
+ CacheDirectory = "spotifyd";
+ SupplementaryGroups = ["audio"];
+ };
+ };
+ };
+
+ meta.maintainers = [ maintainers.anderslundstedt ];
+}