diff --git a/modules/hostSpec/default.nix b/modules/hostSpec/default.nix new file mode 100644 index 0000000..5bb06c6 --- /dev/null +++ b/modules/hostSpec/default.nix @@ -0,0 +1,29 @@ +{ + lib, + config, + inputs, + ... +}: +let + inherit (builtins) mapAttrs; + inherit (lib) mkOption; + inherit (lib.types) lazyAttrsOf submodule; + cfg = config.hostSpec; + hostOptions = submodule { }; + mkSystem = + hostName: _hostConfig: + inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ { networking = { inherit hostName; }; } ]; + }; +in +{ + options.hostSpec.hosts = mkOption { + type = lazyAttrsOf hostOptions; + default = { }; + }; + + config = { + flake.nixosConfigurations = mapAttrs mkSystem cfg.hosts; + }; +}