Add flakeModules.modules, declaring flake.modules
This commit is contained in:
parent
dc3b467eac
commit
d50b490ccc
3 changed files with 102 additions and 0 deletions
|
|
@ -88,6 +88,24 @@ rec {
|
|||
};
|
||||
};
|
||||
|
||||
modulesFlake = mkFlake
|
||||
{
|
||||
inputs.self = { };
|
||||
moduleLocation = "modulesFlake";
|
||||
}
|
||||
{
|
||||
imports = [ flake-parts.flakeModules.modules ];
|
||||
systems = [ ];
|
||||
flake = {
|
||||
modules.generic.example = { lib, ... }: {
|
||||
options.generic.example = lib.mkOption { default = "works in any module system application"; };
|
||||
};
|
||||
modules.foo.example = { lib, ... }: {
|
||||
options.foo.example = lib.mkOption { default = "works in foo application"; };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
flakeModulesDeclare = mkFlake
|
||||
{ inputs.self = { outPath = ./.; }; }
|
||||
({ config, ... }: {
|
||||
|
|
@ -213,6 +231,20 @@ rec {
|
|||
|
||||
assert emptyExposeArgs.moduleLocation == "the self outpath/flake.nix";
|
||||
|
||||
assert (lib.evalModules {
|
||||
class = "barrr";
|
||||
modules = [
|
||||
modulesFlake.modules.generic.example
|
||||
];
|
||||
}).config.generic.example == "works in any module system application";
|
||||
|
||||
assert (lib.evalModules {
|
||||
class = "foo";
|
||||
modules = [
|
||||
modulesFlake.modules.foo.example
|
||||
];
|
||||
}).config.foo.example == "works in foo application";
|
||||
|
||||
assert specialArgFlake.foo;
|
||||
|
||||
ok;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue