git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/spotifyd: init
commit53841fcea9cbd639dfd30714e48959a9752c5818 authorAnders Lundstedt <git@anderslundstedt.se> dateFri 19 Jul 2019, 22:13 (7 years ago) parente6dd87c
2 files changed+43
nixos/modules/module-list.nix+1 nixos/modules/services/audio/spotifyd.nix+42
nixos/modules/module-list.nix+1
@@ -198,6 +198,7 @@
198198 ./services/audio/slimserver.nix
199199 ./services/audio/snapserver.nix
200200 ./services/audio/squeezelite.nix
201+ ./services/audio/spotifyd.nix
201202 ./services/audio/ympd.nix
202203 ./services/backup/automysqlbackup.nix
203204 ./services/backup/bacula.nix
nixos/modules/services/audio/spotifyd.nixnew file+42
@@ -0,0 +1,42 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let
6+ cfg = config.services.spotifyd;
7+ spotifydConf = pkgs.writeText "spotifyd.conf" cfg.config;
8+in
9+{
10+ options = {
11+ services.spotifyd = {
12+ enable = mkEnableOption "spotifyd, a Spotify playing daemon";
13+
14+ config = mkOption {
15+ default = "";
16+ type = types.lines;
17+ description = ''
18+ Configuration for Spotifyd. For syntax and directives, see
19+ https://github.com/Spotifyd/spotifyd#Configuration.
20+ '';
21+ };
22+ };
23+ };
24+
25+ config = mkIf cfg.enable {
26+ systemd.services.spotifyd = {
27+ wantedBy = [ "multi-user.target" ];
28+ after = [ "network-online.target" "sound.target" ];
29+ description = "spotifyd, a Spotify playing daemon";
30+ serviceConfig = {
31+ ExecStart = "${pkgs.spotifyd}/bin/spotifyd --no-daemon --cache_path /var/cache/spotifyd --config ${spotifydConf}";
32+ Restart = "always";
33+ RestartSec = 12;
34+ DynamicUser = true;
35+ CacheDirectory = "spotifyd";
36+ SupplementaryGroups = ["audio"];
37+ };
38+ };
39+ };
40+
41+ meta.maintainers = [ maintainers.anderslundstedt ];
42+}