feat(nixos): pass hostName to nixosSystem, move hm modules

This commit is contained in:
Mohammad Rafiq 2025-07-07 06:48:19 +08:00
parent fe6f0c03b4
commit 092a866959
No known key found for this signature in database
4 changed files with 7 additions and 5 deletions

View file

@ -13,10 +13,13 @@ let
mkConfigurations = mkConfigurations =
class: hosts: class: hosts:
mapAttrs ( mapAttrs (
_: value: name: value:
if class == "nixos" then if class == "nixos" then
nixosSystem { nixosSystem {
specialArgs = { inherit inputs; }; specialArgs = {
inherit inputs;
hostName = name;
};
modules = [ modules = [
(flattenAttrs cfg.modules.nixos) (flattenAttrs cfg.modules.nixos)
(value.extraCfg or { }) (value.extraCfg or { })

View file

@ -1,4 +1,3 @@
let let
testCfg = testCfg =
{ hostName, ... }: { hostName, ... }:

View file

@ -2,12 +2,12 @@
let let
hm = inputs.home-manager; hm = inputs.home-manager;
globalCfg = { globalCfg = {
imports = [ hm.nixosModules.home-manager ];
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
}; };
in in
{ {
imports = [ hm.flakeModules.home-manager ]; imports = [ hm.flakeModules.home-manager ];
flake.modules.nixos.default = globalCfg; flake.modules.nixos.default.imports = [ hm.nixosModules.home-manager ];
flake.modules.nixos.default.config = globalCfg;
} }