aboutsummaryrefslogtreecommitdiff
path: root/tests/modules/merge-module-with-key.nix
diff options
context:
space:
mode:
Diffstat (limited to 'tests/modules/merge-module-with-key.nix')
-rw-r--r--tests/modules/merge-module-with-key.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/modules/merge-module-with-key.nix b/tests/modules/merge-module-with-key.nix
new file mode 100644
index 000000000..21f00e6ef
--- /dev/null
+++ b/tests/modules/merge-module-with-key.nix
@@ -0,0 +1,49 @@
+{ lib, ... }:
+let
+ inherit (lib) mkOption types;
+
+ moduleWithoutKey = {
+ config = {
+ raw = "pear";
+ };
+ };
+
+ moduleWithKey = {
+ key = __curPos.file + "#moduleWithKey";
+ config = {
+ raw = "pear";
+ };
+ };
+
+ decl = {
+ options = {
+ raw = mkOption {
+ type = types.lines;
+ };
+ };
+ };
+in
+{
+ options = {
+ once = mkOption {
+ type = types.submodule {
+ imports = [
+ decl
+ moduleWithKey
+ moduleWithKey
+ ];
+ };
+ default = {};
+ };
+ twice = mkOption {
+ type = types.submodule {
+ imports = [
+ decl
+ moduleWithoutKey
+ moduleWithoutKey
+ ];
+ };
+ default = {};
+ };
+ };
+}