summary refs log tree commit diff stats
path: root/bin
diff options
context:
space:
mode:
authorAlan Pearce2024-05-04 09:26:23 +0200
committerAlan Pearce2024-05-18 12:17:12 +0200
commit72e7e31cefd86fba84924c9b579020a4b733426c (patch)
tree44261fd012cb72bdd7cc9c1a83c1b6ff9854abf8 /bin
parentab8d615544a903e23027f44bfe1310c4296beec5 (diff)
downloadnixfiles-72e7e31cefd86fba84924c9b579020a4b733426c.tar.lz
nixfiles-72e7e31cefd86fba84924c9b579020a4b733426c.tar.zst
nixfiles-72e7e31cefd86fba84924c9b579020a4b733426c.zip
bin: fix resolution of config sources
Diffstat (limited to 'bin')
-rwxr-xr-xbin/home-manager7
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/home-manager b/bin/home-manager
index fa4e1df8..8c83cf27 100755
--- a/bin/home-manager
+++ b/bin/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 @@ end
 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 @@ switch $current_script_name
         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