summary refs log tree commit diff stats
path: root/system/services/nix-sync/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'system/services/nix-sync/default.nix')
-rw-r--r--system/services/nix-sync/default.nix8
1 files changed, 5 insertions, 3 deletions
diff --git a/system/services/nix-sync/default.nix b/system/services/nix-sync/default.nix
index ed0a4fe..d77cb93 100644
--- a/system/services/nix-sync/default.nix
+++ b/system/services/nix-sync/default.nix
@@ -32,9 +32,11 @@
       export XDG_CACHE_HOME="$CACHE_DIRECTORY";
       cd ${esa repoCachePath};
 
+      git fetch
       origin="$(git rev-parse @{u})";
       branch="$(git rev-parse @)";
 
+      # FIXME: this will fail, after a `nix store gc` as the link is not in the gc-roots
       if ! [ "$origin" = "$branch" ]; then
         git pull;
 
@@ -44,12 +46,12 @@
         out_path="$(cat "$out_paths")";
         rm -r ${esa repo.path};
         ln -s "$out_path" ${esa repo.path};
-        rm "$out-paths";
+        rm "$out_paths";
       fi
     '';
     execStartPreScript = ''
       export XDG_CACHE_HOME="$CACHE_DIRECTORY";
-      if ! stat ${esa repoCachePath}/.git; then
+      if ! stat ${esa repoCachePath}/.git 1>/dev/null 2>&1; then
           mkdir --parents ${esa repoCachePath};
           git clone ${esa repo.uri} ${esa repoCachePath};
 
@@ -58,7 +60,7 @@
           [ "$(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};
-          rm "$out-paths";
+          rm "$out_paths";
       fi
     '';
   in {