1
0
Fork 0
mirror of https://github.com/zhaofengli/attic.git synced 2024-12-14 11:57:30 +00:00

nixos: Don't fail if PWD cannot be changed into

Fixes #26.
This commit is contained in:
Zhaofeng Li 2023-02-16 14:01:27 -07:00
parent 5a23cda073
commit 0bb3d00136

View file

@ -22,6 +22,17 @@ let
cat <$configFile >$out
'';
atticadmShim = pkgs.writeShellScript "atticadm" ''
if [ -n "$ATTICADM_PWD" ]; then
cd "$ATTICADM_PWD"
if [ "$?" != "0" ]; then
>&2 echo "Warning: Failed to change directory to $ATTICADM_PWD"
fi
fi
exec ${cfg.package}/bin/atticadm -f ${checkedConfigFile} "$@"
'';
atticadmWrapper = pkgs.writeShellScriptBin "atticd-atticadm" ''
exec systemd-run \
--pty \
@ -32,8 +43,10 @@ let
--property=EnvironmentFile=${cfg.credentialsFile} \
--property=DynamicUser=yes \
--property=User=atticd \
--property=Environment=ATTICADM_PWD=$(pwd) \
--working-directory / \
-- \
${cfg.package}/bin/atticadm -f ${checkedConfigFile} "$@"
${atticadmShim} "$@"
'';
hasLocalPostgresDB = let