Skip to content

Commit

Permalink
add a home-manager host
Browse files Browse the repository at this point in the history
  • Loading branch information
contrun committed Jun 16, 2024
1 parent 23e718e commit 3a29f62
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@
matchResult = builtins.match "([^@]+)@([^@]+)" name;
username = if (matchResult == null) then prefs.owner else (builtins.elemAt matchResult 0);
hostname = if (matchResult == null) then name else (builtins.elemAt matchResult 1);
# If we are using the default home directory (which likely means that we haven't overriden it),
# then we are better of using /home/${username} in home-manager.
home = if (prefs.home == prefs.defaultHome) then "/home/${username}" else prefs.home;
configName = if (matchResult == null) then "${username}@${hostname}" else name;
prefs = getHostPreference hostname;
moduleArgs = {
Expand All @@ -163,7 +166,7 @@
home =
{
inherit username;
homeDirectory = prefs.home;
homeDirectory = home;
stateVersion = prefs.homeManagerStateVersion;
};
}
Expand Down Expand Up @@ -195,7 +198,7 @@
darwinNodes = [ "gcv" ];
allHosts = deployNodes ++ vmNodes ++ [ "default" ] ++ (builtins.attrNames
(import (getNixConfig "fixed-systems.nix")).systems);
homeManagerHosts = [ "madbox" ];
homeManagerHosts = [ "madbox" "contrun@zklab-5" ];
homeManagerConfigs = darwinNodes ++ allHosts ++ homeManagerHosts;
in
(builtins.foldl' (a: e: lib.recursiveUpdate a e) { } [
Expand Down
4 changes: 4 additions & 0 deletions nix/prefs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ let
noproxyGroup = "noproxy";
enablePowerSavingMode = true;
home = "/home/${self.owner}";
defaultHome = "/home/${self.owner}";
syncFolder = "${self.home}/Sync";
nixosSystem = "x86_64-linux";
getNixConfig = path: ./. + "/${path}";
Expand Down Expand Up @@ -1020,6 +1021,9 @@ let
''
];
});
} else if hostname == "zklab-5" then {
home = "/home/contrun";
isMinimalSystem = false;
} else if hostname == "aol" then {
isMinimalSystem = false;
hostId = "85d4bfd4";
Expand Down

0 comments on commit 3a29f62

Please sign in to comment.