mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-14 13:39:15 +03:00
nixos/sogo: prefer 'install' over 'chmod'/'chown'
This commit is contained in:
parent
67ab30a1aa
commit
87051a8f44
1 changed files with 2 additions and 6 deletions
|
@ -2,17 +2,13 @@
|
||||||
cfg = config.services.sogo;
|
cfg = config.services.sogo;
|
||||||
|
|
||||||
preStart = pkgs.writeShellScriptBin "sogo-prestart" ''
|
preStart = pkgs.writeShellScriptBin "sogo-prestart" ''
|
||||||
touch /etc/sogo/sogo.conf
|
|
||||||
chown sogo:sogo /etc/sogo/sogo.conf
|
|
||||||
chmod 640 /etc/sogo/sogo.conf
|
|
||||||
|
|
||||||
${if (cfg.configReplaces != {}) then ''
|
${if (cfg.configReplaces != {}) then ''
|
||||||
# Insert secrets
|
# Insert secrets
|
||||||
${concatStringsSep "\n" (mapAttrsToList (k: v: ''export ${k}="$(cat "${v}" | tr -d '\n')"'') cfg.configReplaces)}
|
${concatStringsSep "\n" (mapAttrsToList (k: v: ''export ${k}="$(cat "${v}" | tr -d '\n')"'') cfg.configReplaces)}
|
||||||
|
|
||||||
${pkgs.perl}/bin/perl -p ${concatStringsSep " " (mapAttrsToList (k: v: '' -e 's/${k}/''${ENV{"${k}"}}/g;' '') cfg.configReplaces)} /etc/sogo/sogo.conf.raw > /etc/sogo/sogo.conf
|
${pkgs.perl}/bin/perl -p ${concatStringsSep " " (mapAttrsToList (k: v: '' -e 's/${k}/''${ENV{"${k}"}}/g;' '') cfg.configReplaces)} /etc/sogo/sogo.conf.raw | install -m 640 -o sogo -g sogo /dev/stdin /etc/sogo/sogo.conf
|
||||||
'' else ''
|
'' else ''
|
||||||
cp /etc/sogo/sogo.conf.raw /etc/sogo/sogo.conf
|
install -m 640 -o sogo -g sogo /etc/sogo/sogo.conf.raw /etc/sogo/sogo.conf
|
||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue