all repos — nixfiles @ 72e7e31cefd86fba84924c9b579020a4b733426c

System and user configuration, managed by nix and home-manager

bin: fix resolution of config sources
Alan Pearce alan@alanpearce.eu
Sat, 04 May 2024 09:26:23 +0200
commit

72e7e31cefd86fba84924c9b579020a4b733426c

parent

ab8d615544a903e23027f44bfe1310c4296beec5

1 files changed, 4 insertions(+), 3 deletions(-)

jump to
M bin/home-managerbin/home-manager
@@ -7,6 +7,7 @@ end 
 set --function channel_root $HOME/.nix-defexpr/channels
 set --function user_nixpkgs $HOME/.nixpkgs
+set --function nixfiles (path resolve (status dirname)/..)
 
 if set --query XDG_CONFIG_HOME
     set --function hm_config_dir $XDG_CONFIG_HOME/home-manager
@@ -68,14 +69,14 @@ set --function current_script_name (status basename)
 switch $current_script_name
     case darwin-rebuild
-        set --local darwin_config_source (path resolve (status dirname)/../system/$hostname.nix)
+        set --local darwin_config_source $nixfiles/system/$hostname.nix
         set --local darwin_config_target $user_nixpkgs/darwin-configuration.nix
         if test ! -e $darwin_config_target
             ln -s $darwin_config_source $darwin_config_target
         end
         set --append argv -I darwin-config=$darwin_config_source
     case nixos-rebuild
-        set --local nixos_config_source (path resolve (status dirname)/system/$hostname.nix)
+        set --local nixos_config_source $nixfiles/system/$hostname.nix
         set --local nixos_config_target $user_nixpkgs/configuration.nix
         if test ! -e $nixos_config_target
             ln -s $nixos_config_source $nixos_config_target
@@ -85,7 +86,7 @@ set --append argv --use-remote-sudo         end
         set --append argv -I nixos-config=$nixos_config_source
     case home-manager
-        set --local hm_config_source (path resolve (status dirname)/../user/$hostname.nix)
+        set --local hm_config_source $nixfiles/user/$hostname.nix
         set --local hm_config_target $hm_config_dir/home.nix
         if test ! -e $hm_config_target
             ln -s $hm_config_source $hm_config_target