summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-07-05 21:21:44 +0200
committerSoispha <soispha@vhack.eu>2023-07-05 21:21:44 +0200
commit16da0f2fc8e02e9363d2f6a6ddf9dd8a715f3901 (patch)
treed0305f2eb1983c467d875c2e91f7ba7662f3c1a8
parentFix(system/services/nix-sync): Pull before rebuilding (diff)
downloadnixos-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.nix5
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