From ebe48f1eafc63f6d06e0f9476c08640fbf99129d Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Thu, 17 Oct 2024 17:06:47 +0200 Subject: [PATCH] lib.types.defaultTypeMerge: change precedence of payload vs wrapped --- lib/types.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/types.nix b/lib/types.nix index 29a4dcef7928e..b91f51c177f2d 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -93,12 +93,14 @@ rec { else if (f.wrapped == null && f'.wrapped == null) && (f.payload == null && f'.payload == null) then f.type + # value types + else if (f.payload != null && f'.payload != null) then + if payload != null + then f.type payload + else null # composed types else if (f.wrapped != null && f'.wrapped != null) && (wrapped != null) then f.type wrapped - # value types - else if (f.payload != null && f'.payload != null) && (payload != null) - then f.type payload else null; # Default type functor @@ -617,7 +619,7 @@ rec { getSubModules = elemType.getSubModules; substSubModules = m: attrsWith { elemType = elemType.substSubModules m; inherit name lazy; }; functor = defaultFunctor "attrsWith" // { - type = payload: attrsWith payload; + wrapped = elemType; payload = { # Important!: Add new function attributes here in case of future changes inherit elemType name lazy; @@ -640,7 +642,7 @@ rec { else null; in - if elemType == null || name == null || lazy == null then + if elemType == null || lazy == null || name == null then null else {