lib/tests: Add submodule file propagation test

This commit is contained in:
Silvan Mosberger 2020-09-27 17:15:57 +02:00 committed by Robert Hensing
parent 492faa4f42
commit 79441600c2
2 changed files with 25 additions and 0 deletions

View File

@ -194,6 +194,10 @@ checkConfigOutput '^"submodule"$' options.submodule.type.description ./declare-s
## Paths should be allowed as values and work as expected
checkConfigOutput '^true$' config.submodule.enable ./declare-submoduleWith-path.nix
# Check the file location information is propagated into submodules
checkConfigOutput the-file.nix config.submodule.internalFiles.0 ./submoduleFiles.nix
# Check that disabledModules works recursively and correctly
checkConfigOutput '^true$' config.enable ./disable-recursive/main.nix
checkConfigOutput '^true$' config.enable ./disable-recursive/{main.nix,disable-foo.nix}

View File

@ -0,0 +1,21 @@
{ lib, ... }: {
options.submodule = lib.mkOption {
default = {};
type = lib.types.submoduleWith {
modules = [ ({ options, ... }: {
options.value = lib.mkOption {};
options.internalFiles = lib.mkOption {
default = options.value.files;
};
})];
};
};
imports = [
{
_file = "the-file.nix";
submodule.value = 10;
}
];
}