summaryrefslogtreecommitdiffstats
path: root/lib/tests/modules/functionTo/merging-attrs.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tests/modules/functionTo/merging-attrs.nix')
-rw-r--r--lib/tests/modules/functionTo/merging-attrs.nix27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/tests/modules/functionTo/merging-attrs.nix b/lib/tests/modules/functionTo/merging-attrs.nix
new file mode 100644
index 000000000000..97c015f928ab
--- /dev/null
+++ b/lib/tests/modules/functionTo/merging-attrs.nix
@@ -0,0 +1,27 @@
+{ lib, config, ... }:
+let
+ inherit (lib) types;
+in {
+ options = {
+ fun = lib.mkOption {
+ type = types.functionTo (types.attrsOf types.str);
+ };
+
+ result = lib.mkOption {
+ type = types.str;
+ default = toString (lib.attrValues (config.fun {
+ a = "a";
+ b = "b";
+ c = "c";
+ }));
+ };
+ };
+
+ config.fun = lib.mkMerge [
+ (input: { inherit (input) a; })
+ (input: { inherit (input) b; })
+ (input: {
+ b = lib.mkForce input.c;
+ })
+ ];
+}