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 c038246
Show file tree
Hide file tree
Showing 2 changed files with 6 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
1 change: 1 addition & 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

0 comments on commit c038246

Please sign in to comment.