From 0f06c7b1454d849cb365f2700c93ab95d52fbdf6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 4 May 2024 12:57:18 +0200 Subject: fix overlays --- bin/home-manager | 32 ++++++++++++++++++++------------ overlays/default.nix | 1 - 2 files changed, 20 insertions(+), 13 deletions(-) delete mode 100644 overlays/default.nix 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 diff --git a/overlays/default.nix b/overlays/default.nix deleted file mode 100644 index ddb4f237..00000000 --- a/overlays/default.nix +++ /dev/null @@ -1 +0,0 @@ -self: super: { } -- cgit 1.4.1