parts/lib: add modules.nix and add to builders.nix

This commit is contained in:
Charlie Root 2024-09-04 07:21:56 +02:00
commit 79c98ac67b
3 changed files with 79 additions and 10 deletions

View file

@ -1,9 +1,12 @@
{inputs, ...}: let
inherit (inputs) self nixpkgs;
inherit (nixpkgs) lib;
inherit (lib) mkDefault nixosSystem recursiveUpdate singleton;
inherit (builtins) concatLists;
in {
{
inputs,
lib,
...
}: let
inherit (inputs) self;
inherit (lib) mkDefault nixosSystem recursiveUpdate;
inherit (lib.lists) singleton concatLists flatten;
inherit (lib.extendedLib.modules) mkModuleTree';
mkSystem = {
withSystem,
system,
@ -38,4 +41,18 @@ in {
];
}
);
mkModulesForSystem = {
hostname,
modulePath ? ./modules,
...
} @ args:
flatten (
concatLists [
(self.outPath + ./.)
(mkModuleTree' {path = self.outPath + modulePath;})
# singleton
]
);
in {
inherit mkSystem mkModulesForSystem;
}