diff options
author | Silvan Mosberger <contact@infinisil.com> | 2021-08-02 21:42:45 +0200 |
---|---|---|
committer | Silvan Mosberger <contact@infinisil.com> | 2022-02-22 15:54:44 +0100 |
commit | 665344f14839ea286a7aeb329fbf4f44da268ce4 (patch) | |
tree | c251e98c95006eaf8162d582b1fbcf4cd57f82db /lib/tests | |
parent | 67596d3fcf34ed9f8749221d0abb714069d3985b (diff) | |
download | nixpkgs-665344f14839ea286a7aeb329fbf4f44da268ce4.tar nixpkgs-665344f14839ea286a7aeb329fbf4f44da268ce4.tar.gz nixpkgs-665344f14839ea286a7aeb329fbf4f44da268ce4.tar.bz2 nixpkgs-665344f14839ea286a7aeb329fbf4f44da268ce4.tar.lz nixpkgs-665344f14839ea286a7aeb329fbf4f44da268ce4.tar.xz nixpkgs-665344f14839ea286a7aeb329fbf4f44da268ce4.tar.zst nixpkgs-665344f14839ea286a7aeb329fbf4f44da268ce4.zip |
lib/types: Introduce types.raw for unprocessed values
Diffstat (limited to 'lib/tests')
-rwxr-xr-x | lib/tests/modules.sh | 6 | ||||
-rw-r--r-- | lib/tests/modules/raw.nix | 30 |
2 files changed, 36 insertions, 0 deletions
diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index 88d152d3935..a1c592cf4ef 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -293,6 +293,12 @@ checkConfigOutput "{ }" config.submodule.a ./emptyValues.nix checkConfigError 'The option .int.a. is used but not defined' config.int.a ./emptyValues.nix checkConfigError 'The option .nonEmptyList.a. is used but not defined' config.nonEmptyList.a ./emptyValues.nix +## types.raw +checkConfigOutput "{ foo = <CODE>; }" config.unprocessedNesting ./raw.nix +checkConfigOutput "10" config.processedToplevel ./raw.nix +checkConfigError "The option .multiple. is defined multiple times" config.multiple ./raw.nix +checkConfigOutput "bar" config.priorities ./raw.nix + cat <<EOF ====== module tests ====== $pass Pass diff --git a/lib/tests/modules/raw.nix b/lib/tests/modules/raw.nix new file mode 100644 index 00000000000..418e671ed07 --- /dev/null +++ b/lib/tests/modules/raw.nix @@ -0,0 +1,30 @@ +{ lib, ... }: { + + options = { + processedToplevel = lib.mkOption { + type = lib.types.raw; + }; + unprocessedNesting = lib.mkOption { + type = lib.types.raw; + }; + multiple = lib.mkOption { + type = lib.types.raw; + }; + priorities = lib.mkOption { + type = lib.types.raw; + }; + }; + + config = { + processedToplevel = lib.mkIf true 10; + unprocessedNesting.foo = throw "foo"; + multiple = lib.mkMerge [ + "foo" + "foo" + ]; + priorities = lib.mkMerge [ + "foo" + (lib.mkForce "bar") + ]; + }; +} |