lib/types: types.{unique,uniq} deprecate functor.wrapped in favor of functor.payload.elemType
This commit is contained in:
parent
b12e0d016e
commit
05958f27e2
@ -75,6 +75,7 @@
|
||||
- `functor.wrapped` is now deprecated for some types and using it will give a warning with migration instructions. It is deprecated for these types:
|
||||
- `lib.types.attrsWith`
|
||||
- `lib.types.listOf`
|
||||
- `lib.types.unique` and `lib.types.uniq`
|
||||
|
||||
- Plasma 5 and Qt 5 based versions of associated software are deprecated in NixOS 25.05, and will be removed in NixOS 25.11. Users are encouraged to upgrade to Plasma 6.
|
||||
|
||||
|
@ -413,8 +413,14 @@ NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribu
|
||||
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.listOf.type.functor.wrapped ./deprecated-wrapped.nix
|
||||
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.mergedListOf.type.functor.wrapped ./deprecated-wrapped.nix
|
||||
|
||||
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.listOf.type.nestedTypes.elemType.functor.wrapped ./deprecated-wrapped.nix
|
||||
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.mergedListOf.type.nestedTypes.elemType.functor.wrapped ./deprecated-wrapped.nix
|
||||
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.unique.type.nestedTypes.elemType.functor.wrapped ./deprecated-wrapped.nix
|
||||
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.mergedUnique.type.nestedTypes.elemType.functor.wrapped ./deprecated-wrapped.nix
|
||||
# unique / uniq
|
||||
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.unique.type.functor.wrapped ./deprecated-wrapped.nix
|
||||
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.mergedUnique.type.functor.wrapped ./deprecated-wrapped.nix
|
||||
|
||||
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.unique.type.nestedTypes.elemType.functor.wrapped ./deprecated-wrapped.nix
|
||||
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.mergedUnique.type.nestedTypes.elemType.functor.wrapped ./deprecated-wrapped.nix
|
||||
|
||||
# Even with multiple assignments, a type error should be thrown if any of them aren't valid
|
||||
checkConfigError 'A definition for option .* is not of type .*' \
|
||||
|
@ -6,6 +6,7 @@ let
|
||||
# attrsOf uses attrsWith internally
|
||||
attrsOf
|
||||
listOf
|
||||
unique
|
||||
;
|
||||
in
|
||||
{
|
||||
@ -26,6 +27,13 @@ in
|
||||
options.mergedListOf = mkOption {
|
||||
type = listOf (listOf types.str);
|
||||
};
|
||||
# unique
|
||||
options.unique = mkOption {
|
||||
type = unique { message = ""; } (listOf types.str);
|
||||
};
|
||||
options.mergedUnique = mkOption {
|
||||
type = unique { message = ""; } (listOf types.str);
|
||||
};
|
||||
}
|
||||
)
|
||||
# Module B
|
||||
@ -38,6 +46,9 @@ in
|
||||
options.mergedListOf = mkOption {
|
||||
type = listOf (listOf types.str);
|
||||
};
|
||||
options.mergedUnique = mkOption {
|
||||
type = unique { message = ""; } (listOf types.str);
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
|
@ -844,7 +844,9 @@ rec {
|
||||
getSubOptions = type.getSubOptions;
|
||||
getSubModules = type.getSubModules;
|
||||
substSubModules = m: uniq (type.substSubModules m);
|
||||
functor = (defaultFunctor name) // { wrapped = type; };
|
||||
functor = elemTypeFunctor name { elemType = type; } // {
|
||||
type = payload: types.unique { inherit message; } payload.elemType;
|
||||
};
|
||||
nestedTypes.elemType = type;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user