mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
lib/tests: Add submodule file propagation test
This commit is contained in:
parent
492faa4f42
commit
79441600c2
@ -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}
|
||||
|
21
lib/tests/modules/submoduleFiles.nix
Normal file
21
lib/tests/modules/submoduleFiles.nix
Normal 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;
|
||||
}
|
||||
];
|
||||
}
|
Loading…
Reference in New Issue
Block a user