diff options
author | Soispha <soispha@vhack.eu> | 2023-07-05 21:21:44 +0200 |
---|---|---|
committer | Soispha <soispha@vhack.eu> | 2023-07-05 21:21:44 +0200 |
commit | 16da0f2fc8e02e9363d2f6a6ddf9dd8a715f3901 (patch) | |
tree | d0305f2eb1983c467d875c2e91f7ba7662f3c1a8 /system/services/nix-sync/default.nix | |
parent | Fix(system/services/nix-sync): Pull before rebuilding (diff) | |
download | nixos-server-16da0f2fc8e02e9363d2f6a6ddf9dd8a715f3901.tar.gz nixos-server-16da0f2fc8e02e9363d2f6a6ddf9dd8a715f3901.zip |
Fix(system/services/nix-sync): Guard deletion of `repo.path`
Diffstat (limited to '')
-rw-r--r-- | system/services/nix-sync/default.nix | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/system/services/nix-sync/default.nix b/system/services/nix-sync/default.nix index d54e4da..33df88e 100644 --- a/system/services/nix-sync/default.nix +++ b/system/services/nix-sync/default.nix @@ -72,7 +72,10 @@ nix build . --print-out-paths --experimental-features 'nix-command flakes' > "$out_paths"; [ "$(wc -l < "$out_paths")" -gt 1 ] && (echo "To many out-paths"; exit 1) out_path="$(cat "$out_paths")"; - rm ${esa repo.path}; + + [ -d ${esa repo.path} ] && rm -d ${esa repo.path}; + [ -e ${esa repo.path} ] && rm ${esa repo.path}; + ln -s "$out_path" ${esa repo.path}; rm "$out_paths"; fi |