pkgs write{Deploy,Test}: allow backup of target

This commit is contained in:
tv 2019-07-16 22:23:50 +02:00
parent 79aa2c6a88
commit 14a54637ce
1 changed files with 4 additions and 4 deletions

View File

@ -36,24 +36,24 @@ in
]; ];
}; };
writeDeploy = name: { force ? false, source, target }: let writeDeploy = name: { backup ? false, force ? false, source, target }: let
target' = lib.mkTarget target; target' = lib.mkTarget target;
in in
writeDash name '' writeDash name ''
set -efu set -efu
${populate { inherit force source; target = target'; }} ${populate { inherit backup force source; target = target'; }}
${rebuild ["dry-build"] target'} ${rebuild ["dry-build"] target'}
${build target'} ${build target'}
${rebuild ["switch"] target'} ${rebuild ["switch"] target'}
''; '';
writeTest = name: { force ? false, source, target }: let writeTest = name: { backup ? false, force ? false, source, target }: let
target' = lib.mkTarget target; target' = lib.mkTarget target;
in in
assert lib.isLocalTarget target'; assert lib.isLocalTarget target';
writeDash name '' writeDash name ''
set -efu set -efu
${populate { inherit force source; target = target'; }} >&2 ${populate { inherit backup force source; target = target'; }} >&2
NIX_PATH=${lib.escapeShellArg target'.path} \ NIX_PATH=${lib.escapeShellArg target'.path} \
${nix}/bin/nix-build \ ${nix}/bin/nix-build \
-A system \ -A system \