refactor: rename modules/flake to flake-parts, hosts to configurations

This commit is contained in:
Mohammad Rafiq 2025-07-07 09:58:25 +08:00
parent f78770d4f1
commit 27161d6b13
No known key found for this signature in database
6 changed files with 0 additions and 0 deletions

35
nix/configurations.nix Normal file
View file

@ -0,0 +1,35 @@
{
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;
inherit (cfg) manifest;
hostName = name;
};
modules = [
(flattenAttrs cfg.modules.nixos)
(value.extraCfg or { })
];
}
else
{ }
) hosts;
in
{
flake.nixosConfigurations = mkConfigurations "nixos" hosts.nixos;
}