summary refs log tree commit diff
path: root/nixos/modules/services/audio
diff options
context:
space:
mode:
authorAndreas Rammhold <andreas@rammhold.de>2018-06-01 13:37:43 +0200
committerAndreas Rammhold <andreas@rammhold.de>2018-06-01 19:17:15 +0200
commita0797bad2c9ea3781367703bb603ab21e5d64d3e (patch)
tree46457828e774029d46bbbc854d3d7e99b13f5273 /nixos/modules/services/audio
parent86990d26bad0d1ffafc7295eec595dd0325576e9 (diff)
downloadnixlib-a0797bad2c9ea3781367703bb603ab21e5d64d3e.tar
nixlib-a0797bad2c9ea3781367703bb603ab21e5d64d3e.tar.gz
nixlib-a0797bad2c9ea3781367703bb603ab21e5d64d3e.tar.bz2
nixlib-a0797bad2c9ea3781367703bb603ab21e5d64d3e.tar.lz
nixlib-a0797bad2c9ea3781367703bb603ab21e5d64d3e.tar.xz
nixlib-a0797bad2c9ea3781367703bb603ab21e5d64d3e.tar.zst
nixlib-a0797bad2c9ea3781367703bb603ab21e5d64d3e.zip
nixos/mpd: allow services.mpd.dbFile to be null
This change allows users to specify an alternative database method. For
example an mpd satellite setup where another mpd on the network shares
it's database with the local instance. The `dbFile` parameter must not be
configured in that case.
Diffstat (limited to 'nixos/modules/services/audio')
-rw-r--r--nixos/modules/services/audio/mpd.nix9
1 files changed, 6 insertions, 3 deletions
diff --git a/nixos/modules/services/audio/mpd.nix b/nixos/modules/services/audio/mpd.nix
index 5f379b392ea8..500a9e35a13b 100644
--- a/nixos/modules/services/audio/mpd.nix
+++ b/nixos/modules/services/audio/mpd.nix
@@ -13,7 +13,9 @@ let
   mpdConf = pkgs.writeText "mpd.conf" ''
     music_directory     "${cfg.musicDirectory}"
     playlist_directory  "${cfg.playlistDirectory}"
-    db_file             "${cfg.dbFile}"
+    ${lib.optionalString (cfg.dbFile != null) ''
+      db_file             "${cfg.dbFile}"
+    ''}
     state_file          "${cfg.dataDir}/state"
     sticker_file        "${cfg.dataDir}/sticker.sql"
     log_file            "syslog"
@@ -126,11 +128,12 @@ in {
       };
 
       dbFile = mkOption {
-        type = types.str;
+        type = types.nullOr types.str;
         default = "${cfg.dataDir}/tag_cache";
         defaultText = ''''${dataDir}/tag_cache'';
         description = ''
-          The path to MPD's database.
+          The path to MPD's database. If set to <literal>null</literal> the
+          paramter is omitted from the configuration.
         '';
       };
     };