8 cfg = config.services.spotifyd;
9 toml = pkgs.formats.toml { };
11 if cfg.config != "" then
12 lib.trace "Using the stringly typed .config attribute is discouraged. Use the TOML typed .settings attribute instead."
16 if cfg.settings != { } then
17 toml.generate "spotify.conf" cfg.settings
19 warnConfig (pkgs.writeText "spotifyd.conf" cfg.config);
24 enable = lib.mkEnableOption "spotifyd, a Spotify playing daemon";
26 config = lib.mkOption {
28 type = lib.types.lines;
30 (Deprecated) Configuration for Spotifyd. For syntax and directives, see
31 <https://docs.spotifyd.rs/config/File.html>.
35 settings = lib.mkOption {
42 Configuration for Spotifyd. For syntax and directives, see
43 <https://docs.spotifyd.rs/config/File.html>.
49 config = lib.mkIf cfg.enable {
52 assertion = cfg.config == "" || cfg.settings == { };
53 message = "At most one of the .config attribute and the .settings attribute may be set";
57 systemd.services.spotifyd = {
58 wantedBy = [ "multi-user.target" ];
59 wants = [ "network-online.target" ];
61 "network-online.target"
64 description = "spotifyd, a Spotify playing daemon";
65 environment.SHELL = "/bin/sh";
67 ExecStart = "${pkgs.spotifyd}/bin/spotifyd --no-daemon --cache-path /var/cache/spotifyd --config-path ${spotifydConf}";
71 CacheDirectory = "spotifyd";
72 SupplementaryGroups = [ "audio" ];
77 meta.maintainers = [ lib.maintainers.anderslundstedt ];