diff options
author | Doron Behar <doron.behar@gmail.com> | 2021-01-11 09:40:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-11 09:40:49 +0200 |
commit | 8addce8b60e351669c7e0303a51a370037ce9c3d (patch) | |
tree | 73bfa5303d3dec8c2c37c77d387671ad8216d006 | |
parent | c4a75629194d46dec2847ac8dee5392aaf5c0778 (diff) | |
parent | 4ce7f285080b9054d287e63ad8ff8a80c19b1a22 (diff) | |
download | nixpkgs-8addce8b60e351669c7e0303a51a370037ce9c3d.tar nixpkgs-8addce8b60e351669c7e0303a51a370037ce9c3d.tar.gz nixpkgs-8addce8b60e351669c7e0303a51a370037ce9c3d.tar.bz2 nixpkgs-8addce8b60e351669c7e0303a51a370037ce9c3d.tar.lz nixpkgs-8addce8b60e351669c7e0303a51a370037ce9c3d.tar.xz nixpkgs-8addce8b60e351669c7e0303a51a370037ce9c3d.tar.zst nixpkgs-8addce8b60e351669c7e0303a51a370037ce9c3d.zip |
Merge pull request #108981 from doronbehar/nixos/mpd
nixos/mpd: use credentials only if needed
-rw-r--r-- | nixos/modules/services/audio/mpd.nix | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/nixos/modules/services/audio/mpd.nix b/nixos/modules/services/audio/mpd.nix index c8e5045f6dc..2e5953dc6f4 100644 --- a/nixos/modules/services/audio/mpd.nix +++ b/nixos/modules/services/audio/mpd.nix @@ -40,7 +40,7 @@ let } ''} - ${credentialsPlaceholder cfg.credentials} + ${optionalString (cfg.credentials != []) (credentialsPlaceholder cfg.credentials)} ${cfg.extraConfig} ''; @@ -234,9 +234,10 @@ in { ExecStartPre = pkgs.writeShellScript "mpd-start-pre" '' set -euo pipefail install -m 600 ${mpdConf} /run/mpd/mpd.conf - ${pkgs.replace}/bin/replace-literal -fe ${ + ${optionalString (cfg.credentials != []) + "${pkgs.replace}/bin/replace-literal -fe ${ concatStringsSep " -a " (imap0 (i: c: "\"{{password-${toString i}}}\" \"$(cat ${c.passwordFile})\"") cfg.credentials) - } /run/mpd/mpd.conf + } /run/mpd/mpd.conf"} ''; RuntimeDirectory = "mpd"; Type = "notify"; |