8 abort "This case should never happen."
9 else if any (x: x == false) (getValues defs) then
14 kernelItem = types.submodule {
27 Use this field for tristate kernel options expecting a "y" or "m" or "n".
32 type = types.nullOr types.str // {
33 merge = mergeEqualOption;
36 example = ''MMC_BLOCK_MINORS.freeform = "32";'';
38 Freeform description of a kernel configuration item value.
43 type = types.bool // {
44 merge = mergeFalseByDefault;
48 Whether option should generate a failure when unused.
49 Upon merging values, mandatory wins over optional.
77 else if val == "y" || val == "m" || val == "n" then
79 else if all isNumber (stringToCharacters val) then
81 else if substring 0 2 val == "0x" then
84 val; # FIXME: fix quoting one day
86 # generate nix intermediate kernel config file of the form
93 # Borrowed from copumpkin https://github.com/NixOS/nixpkgs/pull/12158
94 # returns a string, expr should be an attribute set
95 # Use mkValuePreprocess to preprocess option values, aka mark 'modules' as 'yes' or vice-versa
96 # use the identity if you don't want to override the configured values
103 val = if item.freeform != null then item.freeform else item.tristate;
105 optionalString (val != null) (
106 if (item.optional) then "${key}? ${mkValue val}\n" else "${key} ${mkValue val}\n"
109 mkConf = cfg: concatStrings (mapAttrsToList mkConfigLine cfg);
118 intermediateNixConfig = mkOption {
126 The result of converting the structured kernel configuration in settings
127 to an intermediate string that can be parsed by generate-config.pl to
128 answer the kernel `make defconfig`.
132 settings = mkOption {
133 type = types.attrsOf kernelItem;
134 example = literalExpression ''
138 MMC_BLOCK_MINORS = freeform "32";
141 Structured kernel configuration.
147 intermediateNixConfig = generateNixKConf config.settings;