diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/home-manager | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/bin/home-manager b/bin/home-manager index 8c83cf27..a6e89ce6 100755 --- a/bin/home-manager +++ b/bin/home-manager @@ -6,7 +6,7 @@ if not set --query HOME end set --function channel_root $HOME/.nix-defexpr/channels -set --function user_nixpkgs $HOME/.nixpkgs +set --function user_nixpkgs $HOME/.config/nixpkgs set --function nixfiles (path resolve (status dirname)/..) if set --query XDG_CONFIG_HOME @@ -96,6 +96,19 @@ end set --function old_channels (path basename $channel_root/*) +function update_link --argument-names new_src target + set --function current_src (path resolve $target) + if test -e $current_src + if test $current_src = $new_src + # no need to re-link it + return + else + unlink $target + end + end + ln -s $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) @@ -103,20 +116,15 @@ for np in $NIX_PATH if test $channel = darwin-config continue end + if test $channel = nixpkgs-overlays + update_link $new_src $user_nixpkgs/overlays + continue + end if set --local i (contains --index $channel $old_channels) set --erase old_channels[$i] end - set --local target $channel_root/$channel - set --local src (path resolve $target) - if test -e $src - if test $src = $new_src - # no need to re-link it - continue - else - unlink $target - end - end - ln -s $new_src $target + + update_link $new_src $channel_root/$channel end for old in $channel_root/$old_channels |