summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-06-02 21:31:52 +0200
committerSilas Schöffel <sils@sils.li>2024-06-05 18:42:47 +0200
commit2742072176a41f61e09d62e5a348726effaa1ccb (patch)
tree7c2bacfb84df091e31f9b86ee9e1e4b2b46c776c
parentfix(nix-sync): Ensure that the service can write to all needed paths (diff)
downloadnixos-server-2742072176a41f61e09d62e5a348726effaa1ccb.tar.gz
nixos-server-2742072176a41f61e09d62e5a348726effaa1ccb.zip
fix(nix-sync): Add code-path to create a repo's path, if absent
-rw-r--r--system/services/nix-sync/default.nix6
1 files changed, 5 insertions, 1 deletions
diff --git a/system/services/nix-sync/default.nix b/system/services/nix-sync/default.nix
index 082a8f0..b4a9803 100644
--- a/system/services/nix-sync/default.nix
+++ b/system/services/nix-sync/default.nix
@@ -81,7 +81,11 @@
         [ "$(wc -l < "$out_paths")" -gt 1 ] && (echo "To many out-paths"; exit 1)
         out_path="$(cat "$out_paths")";
 
-        [ -d ${esa repo.path} ] && rm -d ${esa repo.path};
+        if [ -d ${esa repo.path} ]; then
+          rm -d ${esa repo.path};
+        else
+          mkdir --parents "$(dirname ${esa repo.path})";
+        fi
         [ -e ${esa repo.path} ] && rm ${esa repo.path};
 
         ln -s "$out_path" ${esa repo.path};