feat(hm): add sharedModules, move configurations.nix to hosts.nix

This commit is contained in:
Mohammad Rafiq 2025-07-07 07:25:39 +08:00
parent bd347b9889
commit b7358cd825
No known key found for this signature in database
2 changed files with 9 additions and 4 deletions

View file

@ -1,34 +0,0 @@
{
config,
lib,
inputs,
...
}:
let
inherit (lib) nixosSystem;
inherit (cfg.lib) flattenAttrs;
inherit (lib.attrsets) mapAttrs;
cfg = config.flake;
hosts = cfg.manifest.hosts or { };
mkConfigurations =
class: hosts:
mapAttrs (
name: value:
if class == "nixos" then
nixosSystem {
specialArgs = {
inherit inputs;
hostName = name;
};
modules = [
(flattenAttrs cfg.modules.nixos)
(value.extraCfg or { })
];
}
else
{ }
) hosts;
in
{
flake.nixosConfigurations = mkConfigurations "nixos" hosts.nixos;
}