automatically import ${namespace}.${class} as module #9
1 changed files with 4 additions and 0 deletions
automatically import ${namespace}.${class(es)} as modules
Allow to specify a list of classes in the host/<hostname>.nix (by default the class <hostname> is used) that will automatically load specified outputs of inputs.
commit
01106110fe
|
|
@ -15,6 +15,7 @@ let
|
|||
{
|
||||
namespace ? "fbs42",
|
||||
nixpkgs ? "nixpkgs",
|
||||
classes ? [ hostname ],
|
||||
}:
|
||||
inputs.${nixpkgs}.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs flake namespace; };
|
||||
|
|
@ -24,6 +25,9 @@ let
|
|||
base: builtins.attrValues (flake.lib.scan { base = "${base}/host/${hostname}"; })
|
||||
) flake.lib.schema.base
|
||||
)
|
||||
++ map (class: {
|
||||
imports = map (input: input.${namespace}.${class} or { }) (builtins.attrValues inputs);
|
||||
}) classes
|
||||
++ [ { config.networking.hostName = hostname; } ]
|
||||
++ [ nixosModules.default ]
|
||||
++ inputs.${nixpkgs}.lib.optional (inputs ? home-manager) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue