From 16da0f2fc8e02e9363d2f6a6ddf9dd8a715f3901 Mon Sep 17 00:00:00 2001 From: Soispha Date: Wed, 5 Jul 2023 21:21:44 +0200 Subject: Fix(system/services/nix-sync): Guard deletion of `repo.path` --- system/services/nix-sync/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'system/services/nix-sync/default.nix') 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 -- cgit 1.4.1