automatically import ${namespace}.${class} as module #9

Merged
horscchtey merged 1 commit from nonapode/auto-import into main 2025-11-26 19:48:21 +01:00

View file

@ -15,6 +15,7 @@ let
{ {
namespace ? "fbs42", namespace ? "fbs42",
nixpkgs ? "nixpkgs", nixpkgs ? "nixpkgs",
classes ? [ hostname ],
}: }:
inputs.${nixpkgs}.lib.nixosSystem { inputs.${nixpkgs}.lib.nixosSystem {
specialArgs = { inherit inputs flake namespace; }; specialArgs = { inherit inputs flake namespace; };
@ -24,6 +25,9 @@ let
base: builtins.attrValues (flake.lib.scan { base = "${base}/host/${hostname}"; }) base: builtins.attrValues (flake.lib.scan { base = "${base}/host/${hostname}"; })
) flake.lib.schema.base ) flake.lib.schema.base
) )
++ map (class: {
imports = map (input: input.${namespace}.${class} or { }) (builtins.attrValues inputs);
}) classes
++ [ { config.networking.hostName = hostname; } ] ++ [ { config.networking.hostName = hostname; } ]
++ [ nixosModules.default ] ++ [ nixosModules.default ]
++ inputs.${nixpkgs}.lib.optional (inputs ? home-manager) { ++ inputs.${nixpkgs}.lib.optional (inputs ? home-manager) {