summary refs log tree commit diff stats
path: root/bin/home-manager
diff options
context:
space:
mode:
authorAlan Pearce2024-05-21 07:33:27 +0200
committerAlan Pearce2024-05-21 07:33:27 +0200
commitaa212dd7bef8c8326d639d72391e05d47a45be8a (patch)
treef309caf0736c09eb93f7803774c58bf98d3aa6e3 /bin/home-manager
parentabe63fead407367d77e93d05e7076be84c7d525c (diff)
downloadnixfiles-aa212dd7bef8c8326d639d72391e05d47a45be8a.tar.lz
nixfiles-aa212dd7bef8c8326d639d72391e05d47a45be8a.tar.zst
nixfiles-aa212dd7bef8c8326d639d72391e05d47a45be8a.zip
Make nix wrapper scripts resilient to unkeyed NIX_PATH entries
Diffstat (limited to 'bin/home-manager')
-rwxr-xr-xbin/home-manager20
1 files changed, 11 insertions, 9 deletions
diff --git a/bin/home-manager b/bin/home-manager
index 5e10bc77..903e2cab 100755
--- a/bin/home-manager
+++ b/bin/home-manager
@@ -112,17 +112,19 @@ function update_link --argument-names new_src target
 end
 
 for np in $NIX_PATH
-    echo $np | read --function --delimiter "=" channel new_src_rel
-    set --local new_src (path resolve $new_src_rel)
+    if string match --quiet --entire "=" $np
+        echo $np | read --function --delimiter "=" channel new_src_rel
+        set --local new_src (path resolve $new_src_rel)
 
-    if test $channel = darwin-config
-        continue
-    end
-    if set --local i (contains --index $channel $old_channels)
-        set --erase old_channels[$i]
-    end
+        if test $channel = darwin-config
+            continue
+        end
+        if set --local i (contains --index $channel $old_channels)
+            set --erase old_channels[$i]
+        end
 
-    update_link $new_src $channel_root/$channel
+        update_link $new_src $channel_root/$channel
+    end
 end
 
 for old in $channel_root/$old_channels