lib.types.attrNamesToTrue: unpublish temporarily (#407572)

This commit is contained in:
Robert Hensing
2025-05-16 15:03:44 +02:00
committed by GitHub
5 changed files with 27 additions and 34 deletions
-6
View File
@@ -1456,12 +1456,6 @@ let
nestedTypes.finalType = finalType;
};
# A list of attrnames is coerced into an attrset of bools by
# setting the values to true.
attrNamesToTrue = coercedTo (types.listOf types.str) (
enabledList: lib.genAttrs enabledList (_attrName: true)
) (types.attrsOf types.bool);
# Augment the given type with an additional type check function.
addCheck = elemType: check: elemType // { check = x: elemType.check x && check x; };
@@ -135,29 +135,6 @@ merging is handled.
problems.
:::
`types.attrNamesToTrue`
: Either a list of attribute names, or an attribute set of
booleans. A list will be coerced into an attribute set with those
names, whose values are set to `true`. This is useful when it is
convenient to be able to write definitions as a simple list, but
still need to be able to override and disable individual values.
::: {#ex-types-attrNamesToTrue .example}
### `types.attrNamesToTrue`
```
{
foo = [ "bar" ];
}
```
```
{
foo.bar = true;
}
```
:::
`types.pkgs`
: A type for the top level Nixpkgs package set.
+9 -3
View File
@@ -25,6 +25,12 @@ let
${concatStringsSep "\n" config.boot.kernelModules}
'';
# A list of attrnames is coerced into an attrset of bools by
# setting the values to true.
attrNamesToTrue = types.coercedTo (types.listOf types.str) (
enabledList: lib.genAttrs enabledList (_attrName: true)
) (types.attrsOf types.bool);
in
{
@@ -196,7 +202,7 @@ in
};
boot.kernelModules = mkOption {
type = types.attrNamesToTrue;
type = attrNamesToTrue;
default = { };
description = ''
The set of kernel modules to be loaded in the second stage of
@@ -211,7 +217,7 @@ in
};
boot.initrd.availableKernelModules = mkOption {
type = types.attrNamesToTrue;
type = attrNamesToTrue;
default = { };
example = [
"sata_nv"
@@ -238,7 +244,7 @@ in
};
boot.initrd.kernelModules = mkOption {
type = types.attrNamesToTrue;
type = attrNamesToTrue;
default = { };
description = ''
Set of modules that are always loaded by the initrd.
+11 -1
View File
@@ -7,6 +7,16 @@
with lib;
let
# A list of attrnames is coerced into an attrset of bools by
# setting the values to true.
attrNamesToTrue = types.coercedTo (types.listOf types.str) (
enabledList: lib.genAttrs enabledList (_attrName: true)
) (types.attrsOf types.bool);
in
{
###### interface
@@ -25,7 +35,7 @@ with lib;
};
boot.blacklistedKernelModules = mkOption {
type = types.attrNamesToTrue;
type = attrNamesToTrue;
default = { };
example = [
"cirrusfb"
+7 -1
View File
@@ -13,6 +13,12 @@ let
# https://wiki.archlinux.org/index.php/fstab#Filepath_spaces
escape = string: builtins.replaceStrings [ " " "\t" ] [ "\\040" "\\011" ] string;
# A list of attrnames is coerced into an attrset of bools by
# setting the values to true.
attrNamesToTrue = types.coercedTo (types.listOf types.str) (
enabledList: lib.genAttrs enabledList (_attrName: true)
) (types.attrsOf types.bool);
addCheckDesc =
desc: elemType: check:
types.addCheck elemType check // { description = "${elemType.description} (with check: ${desc})"; };
@@ -326,7 +332,7 @@ in
zfs = lib.mkForce false;
}
'';
type = types.attrNamesToTrue;
type = attrNamesToTrue;
description = ''
Names of supported filesystem types, or an attribute set of file system types
and their state. The set form may be used together with `lib.mkForce` to