summary refs log tree commit diff
diff options
context:
space:
mode:
authorsohalt <sohalt@sohalt.net>2020-12-26 17:53:01 +0100
committersohalt <sohalt@sohalt.net>2020-12-26 17:53:01 +0100
commitdcbfdf1a71de390bbdcd88dbc95d6bc03ad50a6f (patch)
tree0e346d713819ec4ceeac787070d1ae47a0a1a310
parentf7384470de0df8e7b82596ae53c86abf2001ab2f (diff)
downloadnixpkgs-dcbfdf1a71de390bbdcd88dbc95d6bc03ad50a6f.tar
nixpkgs-dcbfdf1a71de390bbdcd88dbc95d6bc03ad50a6f.tar.gz
nixpkgs-dcbfdf1a71de390bbdcd88dbc95d6bc03ad50a6f.tar.bz2
nixpkgs-dcbfdf1a71de390bbdcd88dbc95d6bc03ad50a6f.tar.lz
nixpkgs-dcbfdf1a71de390bbdcd88dbc95d6bc03ad50a6f.tar.xz
nixpkgs-dcbfdf1a71de390bbdcd88dbc95d6bc03ad50a6f.tar.zst
nixpkgs-dcbfdf1a71de390bbdcd88dbc95d6bc03ad50a6f.zip
nixos/mpd: remove credentialsFile in favor of credentials option
-rw-r--r--nixos/modules/services/audio/mpd.nix17
1 files changed, 2 insertions, 15 deletions
diff --git a/nixos/modules/services/audio/mpd.nix b/nixos/modules/services/audio/mpd.nix
index 818177f15f7..c8e5045f6dc 100644
--- a/nixos/modules/services/audio/mpd.nix
+++ b/nixos/modules/services/audio/mpd.nix
@@ -193,18 +193,6 @@ in {
         ];
       };
 
-      credentialsFile = mkOption {
-        type = types.path;
-        description = ''
-          Path to a file to be merged with the settings during the service startup.
-          Useful to merge a file which is better kept out of the Nix store
-          because it contains sensible data like MPD's password. Example may look like this:
-          <literal>password "myMpdPassword@read,add,control,admin"</literal>
-        '';
-        default = "/dev/null";
-        example = "/var/lib/secrets/mpd.conf";
-      };
-
       fluidsynth = mkOption {
         type = types.bool;
         default = false;
@@ -244,9 +232,8 @@ in {
           User = "${cfg.user}";
           ExecStart = "${pkgs.mpd}/bin/mpd --no-daemon /run/mpd/mpd.conf";
           ExecStartPre = pkgs.writeShellScript "mpd-start-pre" ''
-            set -xeuo pipefail
-            umask 077
-            cat ${mpdConf} ${cfg.credentialsFile} > /run/mpd/mpd.conf
+            set -euo pipefail
+            install -m 600 ${mpdConf} /run/mpd/mpd.conf
             ${pkgs.replace}/bin/replace-literal -fe ${
               concatStringsSep " -a " (imap0 (i: c: "\"{{password-${toString i}}}\" \"$(cat ${c.passwordFile})\"") cfg.credentials)
             } /run/mpd/mpd.conf