lib.types.attrNamesToTrue: unpublish temporarily
Thank you for making this change. Unfortunately, and I take blame for this, this change to the module system was not reviewed and approved by the module system maintainers. I'm supportive of this change, but extending it on the staging-next branch is not the right place. This commit is also here to make sure that we don't run into conflicts or other git trouble with the staging workflow. Review: It looks alright, but it didn't have tests yet, and it should be considered in a broader context where the existence of this type creates an incentive to be used in cases where the `<attr> = false;` case is undesirable. I'd like to complement this with an type that has `<attr> = {};` only. My apologies for the lack of a timely and clear review. Often we recommend to define the type outside the module system until approved. This commit puts us back in that state. attrNamesToTrue was introduced in 98652f9a901aac50c1d7780ea3507439803a3408
This commit is contained in:
parent
2f214a6041
commit
3dd811c4b9
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user