lol
fork

Configure Feed

Select the types of activity you want to include in your feed.

lib/types: Introduce types.raw for unprocessed values

+73
+6
lib/tests/modules.sh
··· 293 293 checkConfigError 'The option .int.a. is used but not defined' config.int.a ./emptyValues.nix 294 294 checkConfigError 'The option .nonEmptyList.a. is used but not defined' config.nonEmptyList.a ./emptyValues.nix 295 295 296 + ## types.raw 297 + checkConfigOutput "{ foo = <CODE>; }" config.unprocessedNesting ./raw.nix 298 + checkConfigOutput "10" config.processedToplevel ./raw.nix 299 + checkConfigError "The option .multiple. is defined multiple times" config.multiple ./raw.nix 300 + checkConfigOutput "bar" config.priorities ./raw.nix 301 + 296 302 cat <<EOF 297 303 ====== module tests ====== 298 304 $pass Pass
+30
lib/tests/modules/raw.nix
··· 1 + { lib, ... }: { 2 + 3 + options = { 4 + processedToplevel = lib.mkOption { 5 + type = lib.types.raw; 6 + }; 7 + unprocessedNesting = lib.mkOption { 8 + type = lib.types.raw; 9 + }; 10 + multiple = lib.mkOption { 11 + type = lib.types.raw; 12 + }; 13 + priorities = lib.mkOption { 14 + type = lib.types.raw; 15 + }; 16 + }; 17 + 18 + config = { 19 + processedToplevel = lib.mkIf true 10; 20 + unprocessedNesting.foo = throw "foo"; 21 + multiple = lib.mkMerge [ 22 + "foo" 23 + "foo" 24 + ]; 25 + priorities = lib.mkMerge [ 26 + "foo" 27 + (lib.mkForce "bar") 28 + ]; 29 + }; 30 + }
+7
lib/types.nix
··· 162 162 # nixos/doc/manual/development/option-types.xml! 163 163 types = rec { 164 164 165 + raw = mkOptionType rec { 166 + name = "raw"; 167 + description = "raw value"; 168 + check = value: true; 169 + merge = mergeOneOption; 170 + }; 171 + 165 172 anything = mkOptionType { 166 173 name = "anything"; 167 174 description = "anything";
+11
nixos/doc/manual/development/option-types.section.md
··· 63 63 ``` 64 64 ::: 65 65 66 + `types.raw` 67 + 68 + : A type which doesn't do any checking, merging or nested evaluation. It 69 + accepts a single arbitrary value that is not recursed into, making it 70 + useful for values coming from outside the module system, such as package 71 + sets or arbitrary data. Options of this type are still evaluated according 72 + to priorities and conditionals, so `mkForce`, `mkIf` and co. still work on 73 + the option value itself, but not for any value nested within it. This type 74 + should only be used when checking, merging and nested evaluation are not 75 + desirable. 76 + 66 77 `types.attrs` 67 78 68 79 : A free-form attribute set.
+19
nixos/doc/manual/from_md/development/option-types.section.xml
··· 94 94 </varlistentry> 95 95 <varlistentry> 96 96 <term> 97 + <literal>types.raw</literal> 98 + </term> 99 + <listitem> 100 + <para> 101 + A type which doesn’t do any checking, merging or nested 102 + evaluation. It accepts a single arbitrary value that is not 103 + recursed into, making it useful for values coming from 104 + outside the module system, such as package sets or arbitrary 105 + data. Options of this type are still evaluated according to 106 + priorities and conditionals, so <literal>mkForce</literal>, 107 + <literal>mkIf</literal> and co. still work on the option 108 + value itself, but not for any value nested within it. This 109 + type should only be used when checking, merging and nested 110 + evaluation are not desirable. 111 + </para> 112 + </listitem> 113 + </varlistentry> 114 + <varlistentry> 115 + <term> 97 116 <literal>types.attrs</literal> 98 117 </term> 99 118 <listitem>