git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #108981 from doronbehar/nixos/mpd

nixos/mpd: use credentials only if needed

commit8addce8b60e351669c7e0303a51a370037ce9c3d authorDoron Behar <doron.behar@gmail.com> dateMon 11 Jan 2021, 09:40 (6 years ago) parentc4a75624ce7f28
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";