summary refs log tree commit diff stats
path: root/system/services/nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--system/services/nix-sync/default.nix12
1 files changed, 9 insertions, 3 deletions
diff --git a/system/services/nix-sync/default.nix b/system/services/nix-sync/default.nix
index b4a9803..8de5e3c 100644
--- a/system/services/nix-sync/default.nix
+++ b/system/services/nix-sync/default.nix
@@ -34,6 +34,12 @@
       if lib.strings.hasPrefix "/" repo.path
       then ""
       else "/";
+    /*
+    * `ln` tries to create a symlink in the directory, if the target ends with a '/',
+    * thus remove it.
+    */
+    repoPath = lib.strings.removeSuffix "/" repo.path;
+
     repoCachePath = cfg.cachePath + optionalPathSeparator + repo.path;
     execStartScript = pkgs.writeScript "nix-sync-exec" ''
       #! /usr/bin/env dash
@@ -52,7 +58,7 @@
         [ "$(wc -l < "$out_paths")" -gt 1 ] && (echo "To many out-paths"; exit 1)
         out_path="$(cat "$out_paths")";
         rm ${esa repo.path};
-        ln -s "$out_path" ${esa repo.path};
+        ln -s "$out_path" ${esa repoPath};
         rm "$out_paths";
       fi
     '';
@@ -67,7 +73,7 @@
           nix build ${esa repoCachePath} --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")";
-          ln -s "$out_path" ${esa repo.path};
+          ln -s "$out_path" ${esa repoPath};
           rm "$out_paths";
       fi
 
@@ -88,7 +94,7 @@
         fi
         [ -e ${esa repo.path} ] && rm ${esa repo.path};
 
-        ln -s "$out_path" ${esa repo.path};
+        ln -s "$out_path" ${esa repoPath};
         rm "$out_paths";
       fi
     '';