about summary refs log tree commit diff
path: root/lib/tests/modules
diff options
context:
space:
mode:
authorBas van Dijk <v.dijk.bas@gmail.com>2018-08-07 18:44:58 +0200
committerSilvan Mosberger <contact@infinisil.com>2021-01-24 16:56:45 +0100
commit43243539b33d8fb0b2d14a3f9b79d6b641b74e2c (patch)
tree3e36003813c56b66f21c6eb9b8ee66f1057881fd /lib/tests/modules
parentb454af298d0511f43564c5ba2c2b9576bffc025a (diff)
lib/tests/modules: add a test for the functionTo type
(cherry picked from commit 478af112e83df806bd8a51174834d2a130fbdeb9)
Diffstat (limited to 'lib/tests/modules')
-rw-r--r--lib/tests/modules/functionTo.nix29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/tests/modules/functionTo.nix b/lib/tests/modules/functionTo.nix
new file mode 100644
index 0000000000000..591d9a47f93dc
--- /dev/null
+++ b/lib/tests/modules/functionTo.nix
@@ -0,0 +1,29 @@
+{ lib, config, ... }:
+
+with lib;
+
+{
+  options = {
+    selector = mkOption {
+      default = _pkgs : [];
+      type = with types; functionTo (listOf str);
+      description = ''
+        Some descriptive text
+      '';
+    };
+
+    result = mkOption {
+      type = types.str;
+      default = toString (config.selector {
+        a = "a";
+        b = "b";
+        c = "c";
+      });
+    };
+  };
+
+  config = lib.mkMerge [
+    { selector = pkgs: [ pkgs.a ]; }
+    { selector = pkgs: [ pkgs.b ]; }
+  ];
+}