From c0382460f6d19f31430cd0033a0d2665e743ecda Mon Sep 17 00:00:00 2001 From: YI Date: Sun, 16 Jun 2024 14:28:32 +0000 Subject: [PATCH] add a home-manager host --- flake.nix | 7 +++++-- nix/prefs.nix | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 193325c..44b7985 100644 --- a/flake.nix +++ b/flake.nix @@ -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 = { @@ -163,7 +166,7 @@ home = { inherit username; - homeDirectory = prefs.home; + homeDirectory = home; stateVersion = prefs.homeManagerStateVersion; }; } @@ -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) { } [ diff --git a/nix/prefs.nix b/nix/prefs.nix index 8b1ab00..876d4c3 100644 --- a/nix/prefs.nix +++ b/nix/prefs.nix @@ -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}";