Refactor home manager

Make it a bit more modular.
This commit is contained in:
Alexander Wainwright
2025-12-24 17:16:21 +10:00
parent f2eae24609
commit 5f9cada55b
3 changed files with 53 additions and 51 deletions

View File

@@ -18,12 +18,14 @@
outputs = { self, nixpkgs, home-manager, ... }@inputs:
let
# Shared Home Manager configuration function
mkHomeManagerConfig = { isDesktop }: {
mkHomeManagerConfig = { extraModules ? [] }: {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "backup";
home-manager.users.alex = import ./alex/home.nix;
home-manager.extraSpecialArgs = { inherit inputs isDesktop; };
home-manager.users.alex = {
imports = [ ./alex/core.nix ] ++ extraModules;
};
home-manager.extraSpecialArgs = { inherit inputs; };
};
in {
nixosConfigurations = {
@@ -33,7 +35,7 @@
modules = [
./hosts/case/configuration.nix
home-manager.nixosModules.home-manager
(mkHomeManagerConfig { isDesktop = true; })
(mkHomeManagerConfig { extraModules = [ ./alex/desktop.nix ]; })
];
};
@@ -43,7 +45,7 @@
modules = [
./hosts/count/configuration.nix
home-manager.nixosModules.home-manager
(mkHomeManagerConfig { isDesktop = true; })
(mkHomeManagerConfig { extraModules = [ ./alex/desktop.nix ]; })
];
};
@@ -53,7 +55,7 @@
modules = [
./hosts/armitage/configuration.nix
home-manager.nixosModules.home-manager
(mkHomeManagerConfig { isDesktop = true; })
(mkHomeManagerConfig { extraModules = [ ./alex/desktop.nix ]; })
];
};
@@ -63,7 +65,7 @@
modules = [
./hosts/alt/configuration.nix
home-manager.nixosModules.home-manager
(mkHomeManagerConfig { isDesktop = false; })
(mkHomeManagerConfig {})
];
};
@@ -73,10 +75,10 @@
modules = [
./hosts/nightcity/configuration.nix
home-manager.nixosModules.home-manager
(mkHomeManagerConfig { isDesktop = false; })
(mkHomeManagerConfig {})
];
};
# other hosts...
};
};
}
}