refactor: rename modules/flake to flake-parts, hosts to configurations
This commit is contained in:
parent
f78770d4f1
commit
27161d6b13
6 changed files with 0 additions and 0 deletions
35
nix/configurations.nix
Normal file
35
nix/configurations.nix
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue