git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/mpd: use credentials only if needed
commit4ce7f285080b9054d287e63ad8ff8a80c19b1a22 authorDoron Behar <doron.behar@gmail.com> dateSun 10 Jan 2021, 23:56 (6 years ago) parentd085417
1 file changed+4−3
nixos/modules/services/audio/mpd.nix+4−3
nixos/modules/services/audio/mpd.nix+4−3
@@ -40,7 +40,7 @@ let
4040 }
4141 ''}
4242
43− ${credentialsPlaceholder cfg.credentials}
43+ ${optionalString (cfg.credentials != []) (credentialsPlaceholder cfg.credentials)}
4444
4545 ${cfg.extraConfig}
4646 '';
@@ -234,9 +234,10 @@ in {
234234 ExecStartPre = pkgs.writeShellScript "mpd-start-pre" ''
235235 set -euo pipefail
236236 install -m 600 ${mpdConf} /run/mpd/mpd.conf
237− ${pkgs.replace}/bin/replace-literal -fe ${
237+ ${optionalString (cfg.credentials != [])
238+ "${pkgs.replace}/bin/replace-literal -fe ${
238239 concatStringsSep " -a " (imap0 (i: c: "\"{{password-${toString i}}}\" \"$(cat ${c.passwordFile})\"") cfg.credentials)
239− } /run/mpd/mpd.conf
240+ } /run/mpd/mpd.conf"}
240241 '';
241242 RuntimeDirectory = "mpd";
242243 Type = "notify";