core/lib/tests/modules/merge-module-with-key.nix

48 lines
720 B
Nix
Raw Normal View History

2024-05-01 22:14:04 +00:00
{ lib, ... }:
let
inherit (lib) mkOption types;
moduleWithoutKey = {
config = {
raw = "pear";
};
};
moduleWithKey = {
key = __curPos.file + "#moduleWithKey";
config = {
raw = "pear";
};
};
decl = {
options = {
2024-06-30 08:16:52 +00:00
raw = mkOption { type = types.lines; };
2024-05-01 22:14:04 +00:00
};
};
in
{
options = {
once = mkOption {
type = types.submodule {
imports = [
decl
moduleWithKey
moduleWithKey
];
};
2024-06-30 08:16:52 +00:00
default = { };
2024-05-01 22:14:04 +00:00
};
twice = mkOption {
type = types.submodule {
imports = [
decl
moduleWithoutKey
moduleWithoutKey
];
};
2024-06-30 08:16:52 +00:00
default = { };
2024-05-01 22:14:04 +00:00
};
};
}