From 5782ef8dc37f8451339dea316a1ef40d5d68540b Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Mon, 6 Jan 2025 15:25:08 +0100 Subject: [PATCH] lib/types: deprecate functor.wrapped in types.listOf --- doc/release-notes/rl-2505.section.md | 1 + lib/types.nix | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/release-notes/rl-2505.section.md b/doc/release-notes/rl-2505.section.md index c06b1af63aa4..901124b91c7c 100644 --- a/doc/release-notes/rl-2505.section.md +++ b/doc/release-notes/rl-2505.section.md @@ -23,3 +23,4 @@ `functor` is an implementation detail and should not be relied upon, but since its status wasn't clear and it has had some use cases without alternatives, changes are being handled as gracefully as possible. Deprecations within functor: - `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` diff --git a/lib/types.nix b/lib/types.nix index b988ff1a89a9..e74775d0a27a 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -600,7 +600,9 @@ rec { getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["*"]); getSubModules = elemType.getSubModules; substSubModules = m: listOf (elemType.substSubModules m); - functor = (defaultFunctor name) // { wrapped = elemType; }; + functor = (elemTypeFunctor name { inherit elemType; }) // { + type = payload: types.listOf payload.elemType; + }; nestedTypes.elemType = elemType; };