mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 04:05:40 +03:00
lib/types: types.coercedTo deprecate functor.wrapped in favor of functor.payload.elemType
This commit is contained in:
parent
f6214eb786
commit
4f123107b4
4 changed files with 21 additions and 5 deletions
|
@ -78,6 +78,7 @@
|
||||||
- `lib.types.unique` and `lib.types.uniq`
|
- `lib.types.unique` and `lib.types.uniq`
|
||||||
- `lib.types.nullOr`
|
- `lib.types.nullOr`
|
||||||
- `lib.types.functionTo`
|
- `lib.types.functionTo`
|
||||||
|
- `lib.types.coercedTo`
|
||||||
|
|
||||||
- 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.
|
- 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.
|
||||||
|
|
||||||
|
|
|
@ -434,6 +434,12 @@ 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.functionTo.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.functionTo.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.mergedFunctionTo.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.mergedFunctionTo.type.nestedTypes.elemType.functor.wrapped ./deprecated-wrapped.nix
|
||||||
|
|
||||||
|
# coercedTo
|
||||||
|
# Note: test 'nestedTypes.finalType' and 'nestedTypes.coercedType'
|
||||||
|
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.coercedTo.type.functor.wrapped ./deprecated-wrapped.nix
|
||||||
|
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.coercedTo.type.nestedTypes.finalType.functor.wrapped ./deprecated-wrapped.nix
|
||||||
|
NIX_ABORT_ON_WARN=1 checkConfigError 'The deprecated `.*functor.wrapped` attribute .*is accessed, use `.*nestedTypes.elemType` instead.' options.coercedTo.type.nestedTypes.coercedType.functor.wrapped ./deprecated-wrapped.nix
|
||||||
|
|
||||||
# Even with multiple assignments, a type error should be thrown if any of them aren't valid
|
# 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 .*' \
|
checkConfigError 'A definition for option .* is not of type .*' \
|
||||||
config.value ./declare-int-unsigned-value.nix ./define-value-list.nix ./define-value-int-positive.nix
|
config.value ./declare-int-unsigned-value.nix ./define-value-list.nix ./define-value-int-positive.nix
|
||||||
|
|
|
@ -9,6 +9,7 @@ let
|
||||||
unique
|
unique
|
||||||
nullOr
|
nullOr
|
||||||
functionTo
|
functionTo
|
||||||
|
coercedTo
|
||||||
;
|
;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -43,13 +44,18 @@ in
|
||||||
options.mergedNullOr = mkOption {
|
options.mergedNullOr = mkOption {
|
||||||
type = nullOr (listOf types.str);
|
type = nullOr (listOf types.str);
|
||||||
};
|
};
|
||||||
# nullOr
|
# functionTo
|
||||||
options.functionTo = mkOption {
|
options.functionTo = mkOption {
|
||||||
type = functionTo (listOf types.str);
|
type = functionTo (listOf types.str);
|
||||||
};
|
};
|
||||||
options.mergedFunctionTo = mkOption {
|
options.mergedFunctionTo = mkOption {
|
||||||
type = functionTo (listOf types.str);
|
type = functionTo (listOf types.str);
|
||||||
};
|
};
|
||||||
|
# coercedTo
|
||||||
|
# Note: coercedTo is a non-mergeable option-type
|
||||||
|
options.coercedTo = mkOption {
|
||||||
|
type = coercedTo (listOf types.str) lib.id (listOf types.str);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
# Module B
|
# Module B
|
||||||
|
|
|
@ -75,6 +75,7 @@ let
|
||||||
# Note that individual attributes can be overriden if needed.
|
# Note that individual attributes can be overriden if needed.
|
||||||
elemTypeFunctor = name: { elemType, ... }@payload: {
|
elemTypeFunctor = name: { elemType, ... }@payload: {
|
||||||
inherit name payload;
|
inherit name payload;
|
||||||
|
wrappedDeprecationMessage = makeWrappedDeprecationMessage payload;
|
||||||
type = outer_types.types.${name};
|
type = outer_types.types.${name};
|
||||||
binOp = a: b:
|
binOp = a: b:
|
||||||
let
|
let
|
||||||
|
@ -85,10 +86,10 @@ let
|
||||||
null
|
null
|
||||||
else
|
else
|
||||||
{ elemType = merged; };
|
{ elemType = merged; };
|
||||||
wrappedDeprecationMessage = { loc }: lib.warn ''
|
};
|
||||||
|
makeWrappedDeprecationMessage = payload: { loc }: lib.warn ''
|
||||||
The deprecated `${lib.optionalString (loc != null) "type."}functor.wrapped` attribute ${lib.optionalString (loc != null) "of the option `${showOption loc}` "}is accessed, use `${lib.optionalString (loc != null) "type."}nestedTypes.elemType` instead.
|
The deprecated `${lib.optionalString (loc != null) "type."}functor.wrapped` attribute ${lib.optionalString (loc != null) "of the option `${showOption loc}` "}is accessed, use `${lib.optionalString (loc != null) "type."}nestedTypes.elemType` instead.
|
||||||
'' payload.elemType;
|
'' payload.elemType;
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
outer_types =
|
outer_types =
|
||||||
|
@ -1163,7 +1164,9 @@ rec {
|
||||||
getSubModules = finalType.getSubModules;
|
getSubModules = finalType.getSubModules;
|
||||||
substSubModules = m: coercedTo coercedType coerceFunc (finalType.substSubModules m);
|
substSubModules = m: coercedTo coercedType coerceFunc (finalType.substSubModules m);
|
||||||
typeMerge = t: null;
|
typeMerge = t: null;
|
||||||
functor = (defaultFunctor name) // { wrapped = finalType; };
|
functor = (defaultFunctor name) // {
|
||||||
|
wrappedDeprecationMessage = makeWrappedDeprecationMessage { elemType = finalType; };
|
||||||
|
};
|
||||||
nestedTypes.coercedType = coercedType;
|
nestedTypes.coercedType = coercedType;
|
||||||
nestedTypes.finalType = finalType;
|
nestedTypes.finalType = finalType;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue