From aa212dd7bef8c8326d639d72391e05d47a45be8a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 21 May 2024 07:33:27 +0200 Subject: Make nix wrapper scripts resilient to unkeyed NIX_PATH entries --- bin/home-manager | 20 +++++++++++--------- 1 file 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 -- cgit 1.4.1