From faf7bd1d3868acefe7b9e82a14b5dfa906596d07 Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Wed, 29 Apr 2026 09:41:53 -0400 Subject: [PATCH 01/12] stdenv.mkDerivation: move concretizeFlagImplications to global scope --- pkgs/stdenv/generic/make-derivation.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index e6df0134b234..7a17cb27737e 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -165,6 +165,10 @@ let "zerocallusedregs" ]; + concretizeFlagImplications = + flag: impliesFlags: list: + if elem flag list then (list ++ impliesFlags) else list; + removedOrReplacedAttrNames = [ "checkInputs" "installCheckInputs" @@ -409,10 +413,6 @@ let actualValue; outputs' = if separateDebugInfo' then outputs ++ [ "debug" ] else outputs; - concretizeFlagImplications = - flag: impliesFlags: list: - if elem flag list then (list ++ impliesFlags) else list; - hardeningDisable' = unique ( pipe hardeningDisable [ # disabling fortify implies fortify3 should also be disabled From 32dc7f6f02e01cd844fd289d5f7b1b47ed769ea8 Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Wed, 29 Apr 2026 09:44:54 -0400 Subject: [PATCH 02/12] stdenv.mkDerivation: inline hardeningDisable' We can safely check `elem "all" hardeningDisable'` on the original list, because calling `unique` and `concretizeFlagImplications` will never change whether the list contains "all". --- pkgs/stdenv/generic/make-derivation.nix | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 7a17cb27737e..855615856299 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -413,21 +413,20 @@ let actualValue; outputs' = if separateDebugInfo' then outputs ++ [ "debug" ] else outputs; - hardeningDisable' = unique ( - pipe hardeningDisable [ - # disabling fortify implies fortify3 should also be disabled - (concretizeFlagImplications "fortify" [ "fortify3" ]) - # disabling strictflexarrays1 implies strictflexarrays3 should also be disabled - (concretizeFlagImplications "strictflexarrays1" [ "strictflexarrays3" ]) - # disabling libcxxhardeningfast implies libcxxhardeningextensive should also be disabled - (concretizeFlagImplications "libcxxhardeningfast" [ "libcxxhardeningextensive" ]) - ] - ); enabledHardeningOptions = - if elem "all" hardeningDisable' then + if elem "all" hardeningDisable then [ ] else - subtractLists hardeningDisable' (defaultHardeningFlags ++ hardeningEnable); + subtractLists (unique ( + pipe hardeningDisable [ + # disabling fortify implies fortify3 should also be disabled + (concretizeFlagImplications "fortify" [ "fortify3" ]) + # disabling strictflexarrays1 implies strictflexarrays3 should also be disabled + (concretizeFlagImplications "strictflexarrays1" [ "strictflexarrays3" ]) + # disabling libcxxhardeningfast implies libcxxhardeningextensive should also be disabled + (concretizeFlagImplications "libcxxhardeningfast" [ "libcxxhardeningextensive" ]) + ] + )) (defaultHardeningFlags ++ hardeningEnable); # hardeningDisable additionally supports "all". erroneousHardeningFlags = subtractLists knownHardeningFlags ( hardeningEnable ++ remove "all" hardeningDisable From 9c1453602e75fb9c4632dfabb26fe928afe18b7a Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Wed, 29 Apr 2026 09:58:53 -0400 Subject: [PATCH 03/12] stdenv.mkDerivation: only create enabledHardeningOptions variable if necessary --- pkgs/stdenv/generic/make-derivation.nix | 30 +++++++++++++------------ 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 855615856299..a5470d9b6c2b 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -413,20 +413,6 @@ let actualValue; outputs' = if separateDebugInfo' then outputs ++ [ "debug" ] else outputs; - enabledHardeningOptions = - if elem "all" hardeningDisable then - [ ] - else - subtractLists (unique ( - pipe hardeningDisable [ - # disabling fortify implies fortify3 should also be disabled - (concretizeFlagImplications "fortify" [ "fortify3" ]) - # disabling strictflexarrays1 implies strictflexarrays3 should also be disabled - (concretizeFlagImplications "strictflexarrays1" [ "strictflexarrays3" ]) - # disabling libcxxhardeningfast implies libcxxhardeningextensive should also be disabled - (concretizeFlagImplications "libcxxhardeningfast" [ "libcxxhardeningextensive" ]) - ] - )) (defaultHardeningFlags ++ hardeningEnable); # hardeningDisable additionally supports "all". erroneousHardeningFlags = subtractLists knownHardeningFlags ( hardeningEnable ++ remove "all" hardeningDisable @@ -694,6 +680,22 @@ let else null } = + let + enabledHardeningOptions = + if elem "all" hardeningDisable then + [ ] + else + subtractLists (unique ( + pipe hardeningDisable [ + # disabling fortify implies fortify3 should also be disabled + (concretizeFlagImplications "fortify" [ "fortify3" ]) + # disabling strictflexarrays1 implies strictflexarrays3 should also be disabled + (concretizeFlagImplications "strictflexarrays1" [ "strictflexarrays3" ]) + # disabling libcxxhardeningfast implies libcxxhardeningextensive should also be disabled + (concretizeFlagImplications "libcxxhardeningfast" [ "libcxxhardeningextensive" ]) + ] + )) (defaultHardeningFlags ++ hardeningEnable); + in concatStringsSep " " enabledHardeningOptions; # TODO: remove platform condition From 95a031c36339a349f90c9d949f5c37178af6b351 Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Fri, 1 May 2026 16:10:27 -0400 Subject: [PATCH 04/12] stdenv.mkDerivation: remove assertMsg usage Saves function calls on the happy path. --- pkgs/stdenv/generic/make-derivation.nix | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index a5470d9b6c2b..263bc63ddb8c 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -14,7 +14,6 @@ let # Lib attributes are inherited to the lexical scope for performance reasons. inherit (lib) all - assertMsg attrNames concatLists concatMap @@ -602,9 +601,8 @@ let attrs.name + hostSuffix else # we cannot coerce null to a string below - assert assertMsg ( - attrs ? version && attrs.version != null - ) "The `version` attribute cannot be null."; + assert + (attrs ? version && attrs.version != null) || throw "The `version` attribute cannot be null."; "${attrs.pname}${staticMarker}${hostSuffix}-${attrs.version}" ); @@ -919,14 +917,17 @@ let }" ) overlappingNames; in - assert assertMsg (isAttrs env && !isDerivation env) - "`env` must be an attribute set of environment variables. Set `env.env` or pick a more specific name."; - assert assertMsg (overlappingNames == [ ]) - "The `env` attribute set cannot contain any attributes passed to derivation. The following attributes are overlapping:\n${errors}"; + assert + (isAttrs env && !isDerivation env) + || throw "`env` must be an attribute set of environment variables. Set `env.env` or pick a more specific name."; + assert + (overlappingNames == [ ]) + || throw "The `env` attribute set cannot contain any attributes passed to derivation. The following attributes are overlapping:\n${errors}"; mapAttrs ( n: v: - assert assertMsg (isString v || isBool v || isInt v || isDerivation v) - "The `env` attribute set can only contain derivation, string, boolean or integer attributes. The `${n}` attribute is of type ${builtins.typeOf v}."; + assert + (isString v || isBool v || isInt v || isDerivation v) + || throw "The `env` attribute set can only contain derivation, string, boolean or integer attributes. The `${n}` attribute is of type ${builtins.typeOf v}."; v ) env'; From 2113c381ea0a2b9b404a7a99aa8f39f4b9f854d8 Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Fri, 1 May 2026 16:12:18 -0400 Subject: [PATCH 05/12] stdenv.mkDerivation: move errors variable out of happy path --- pkgs/stdenv/generic/make-derivation.nix | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 263bc63ddb8c..ca9dc2a29a7a 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -910,19 +910,24 @@ let checkedEnv = let overlappingNames = attrNames (builtins.intersectAttrs env' derivationArg); - errors = lib.concatMapStringsSep "\n" ( - name: - " - ${name}: in `env`: ${lib.generators.toPretty { } env'.${name}}; in derivation arguments: ${ - lib.generators.toPretty { } derivationArg.${name} - }" - ) overlappingNames; in assert (isAttrs env && !isDerivation env) || throw "`env` must be an attribute set of environment variables. Set `env.env` or pick a more specific name."; assert (overlappingNames == [ ]) - || throw "The `env` attribute set cannot contain any attributes passed to derivation. The following attributes are overlapping:\n${errors}"; + || throw ( + let + errors = lib.concatMapStringsSep "\n" ( + name: + " - ${name}: in `env`: ${lib.generators.toPretty { } env'.${name}}; in derivation arguments: ${ + lib.generators.toPretty { } derivationArg.${name} + }" + ) overlappingNames; + + in + "The `env` attribute set cannot contain any attributes passed to derivation. The following attributes are overlapping:\n${errors}" + ); mapAttrs ( n: v: assert From dfa34d93769703cd099a0f2f86cb39c67a4d0f41 Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Fri, 1 May 2026 16:13:59 -0400 Subject: [PATCH 06/12] stdenv.mkDerivation: move attrNames out of happy path --- pkgs/stdenv/generic/make-derivation.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index ca9dc2a29a7a..a3bef62d4d71 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -26,6 +26,7 @@ let getDev head foldl' + intersectAttrs isAttrs isBool isDerivation @@ -909,13 +910,13 @@ let checkedEnv = let - overlappingNames = attrNames (builtins.intersectAttrs env' derivationArg); + overlappingArgs = intersectAttrs env' derivationArg; in assert (isAttrs env && !isDerivation env) || throw "`env` must be an attribute set of environment variables. Set `env.env` or pick a more specific name."; assert - (overlappingNames == [ ]) + (overlappingArgs == { }) || throw ( let errors = lib.concatMapStringsSep "\n" ( @@ -923,7 +924,7 @@ let " - ${name}: in `env`: ${lib.generators.toPretty { } env'.${name}}; in derivation arguments: ${ lib.generators.toPretty { } derivationArg.${name} }" - ) overlappingNames; + ) (attrNames overlappingArgs); in "The `env` attribute set cannot contain any attributes passed to derivation. The following attributes are overlapping:\n${errors}" From 57c99d57221c89a1b2911753026b0376fb9ea1cf Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Thu, 7 May 2026 21:41:27 -0400 Subject: [PATCH 07/12] stdenv.mkDerivation: move list of attribute names out to global scope --- pkgs/stdenv/generic/make-derivation.nix | 41 ++++++++++++------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index a3bef62d4d71..6724fb18f487 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -187,6 +187,25 @@ let "allowedImpureDLLs" ]; + attrsToRemoveLast = [ + # Fixed-output derivations may not reference other paths, which means that + # for a fixed-output derivation, the corresponding inputDerivation should + # *not* be fixed-output. To achieve this we simply delete the attributes that + # would make it fixed-output. + "outputHashAlgo" + "outputHash" + "outputHashMode" + + # inputDerivation produces the inputs; not the outputs, so any + # restrictions on what used to be the outputs don't serve a purpose + # anymore. + "allowedReferences" + "allowedRequisites" + "disallowedReferences" + "disallowedRequisites" + "outputChecks" + ]; + inherit (stdenv) hostPlatform buildPlatform @@ -936,26 +955,6 @@ let || throw "The `env` attribute set can only contain derivation, string, boolean or integer attributes. The `${n}` attribute is of type ${builtins.typeOf v}."; v ) env'; - - attrsToRemove = [ - # Fixed-output derivations may not reference other paths, which means that - # for a fixed-output derivation, the corresponding inputDerivation should - # *not* be fixed-output. To achieve this we simply delete the attributes that - # would make it fixed-output. - "outputHashAlgo" - "outputHash" - "outputHashMode" - - # inputDerivation produces the inputs; not the outputs, so any - # restrictions on what used to be the outputs don't serve a purpose - # anymore. - "allowedReferences" - "allowedRequisites" - "disallowedReferences" - "disallowedRequisites" - "outputChecks" - ]; - in extendDerivation validity.handled ( @@ -966,7 +965,7 @@ let # needed to enter a nix-shell with # nix-build shell.nix -A inputDerivation inputDerivation = derivation ( - removeAttrs derivationArg attrsToRemove + removeAttrs derivationArg attrsToRemoveLast // { # Add a name in case the original drv didn't have one name = "inputDerivation" + optionalString (derivationArg ? name) "-${derivationArg.name}"; From 8de09cd1f8839e9af47ad9ce8e23028087c45438 Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Thu, 7 May 2026 21:43:40 -0400 Subject: [PATCH 08/12] stdenv.mkDerivation: move reference checking attrs to global scope --- pkgs/stdenv/generic/make-derivation.nix | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 6724fb18f487..c7415b226a46 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -187,6 +187,13 @@ let "allowedImpureDLLs" ]; + referenceCheckingAttrsToRemove = [ + "allowedReferences" + "allowedRequisites" + "disallowedReferences" + "disallowedRequisites" + ]; + attrsToRemoveLast = [ # Fixed-output derivations may not reference other paths, which means that # for a fixed-output derivation, the corresponding inputDerivation should @@ -828,12 +835,7 @@ let # that's "normal". Notably it symlinks to the source. # So disable reference checking for the debug output if separateDebugInfo' && name == "debug" then - removeAttrs raw [ - "allowedReferences" - "allowedRequisites" - "disallowedReferences" - "disallowedRequisites" - ] + removeAttrs raw referenceCheckingAttrsToRemove else raw; }) outputs From 9f278a55db99e9e575ec31f0fc555ed8c8b2cd4e Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Thu, 7 May 2026 21:49:42 -0400 Subject: [PATCH 09/12] stdenv.mkDerivation: store default builder args in global scope --- pkgs/stdenv/generic/make-derivation.nix | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index c7415b226a46..a3062c6024e2 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -213,6 +213,12 @@ let "outputChecks" ]; + defaultBuilderArgs = [ + "-e" + ./source-stdenv.sh + ./default-builder.sh + ]; + inherit (stdenv) hostPlatform buildPlatform @@ -635,11 +641,16 @@ let builder = attrs.realBuilder or stdenvShell; args = - attrs.args or [ - "-e" - ./source-stdenv.sh - (attrs.builder or ./default-builder.sh) - ]; + attrs.args or ( + if attrs ? builder then + [ + "-e" + ./source-stdenv.sh + attrs.builder + ] + else + defaultBuilderArgs + ); inherit stdenv; # The `system` attribute of a derivation has special meaning to Nix. From 789a15ef68b7c509ed7ff315ef9ea8ce0b4ac864 Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Thu, 7 May 2026 21:53:49 -0400 Subject: [PATCH 10/12] stdenv.mkDerivation: move attrs removed for derivationArg to global scope --- pkgs/stdenv/generic/make-derivation.nix | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index a3062c6024e2..bc8522a5cfec 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -194,6 +194,13 @@ let "disallowedRequisites" ]; + argumentAttrsToRemove = [ + "meta" + "passthru" + "pos" + "env" + ]; + attrsToRemoveLast = [ # Fixed-output derivations may not reference other paths, which means that # for a fixed-output derivation, the corresponding inputDerivation should @@ -917,12 +924,7 @@ let if attrs ? meta.mainProgram then env // { NIX_MAIN_PROGRAM = attrs.meta.mainProgram; } else env; derivationArg = makeDerivationArgument ( - removeAttrs attrs [ - "meta" - "passthru" - "pos" - "env" - ] + removeAttrs attrs argumentAttrsToRemove // { ${if __structuredAttrs then "env" else null} = checkedEnv; cmakeFlags = makeCMakeFlags attrs; From 13fb2f08dc9511aae71dd4d570cf728bb23fe2f0 Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Sat, 9 May 2026 20:32:15 -0400 Subject: [PATCH 11/12] stdenv.mkDerivation: inherit all lib variables --- pkgs/stdenv/generic/make-derivation.nix | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index bc8522a5cfec..d5272a522b05 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -18,6 +18,7 @@ let concatLists concatMap concatMapStrings + concatMapStringsSep concatStringsSep elem extendDerivation @@ -41,14 +42,19 @@ let optionals pipe remove + seq splitString subtractLists + toExtension toFunction unique + warnIf zipAttrsWith - seq ; + inherit (lib.generators) toPretty; + inherit (lib.strings) sanitizeDerivationName; + inherit (import ../../build-support/lib/cmake.nix { inherit lib stdenv; }) makeCMakeFlags; inherit (import ../../build-support/lib/meson.nix { inherit lib stdenv; }) makeMesonFlags; @@ -101,10 +107,10 @@ let final: let prev = rattrs final; - thisOverlay = lib.toExtension f0 final prev; + thisOverlay = toExtension f0 final prev; pos = builtins.unsafeGetAttrPos "version" thisOverlay; in - lib.warnIf + warnIf ( prev ? src && thisOverlay ? version @@ -482,7 +488,7 @@ let if erroneousHardeningFlags != [ ] then abort ( "mkDerivation was called with unsupported hardening flags: " - + lib.generators.toPretty { } { + + toPretty { } { inherit erroneousHardeningFlags hardeningDisable @@ -636,7 +642,7 @@ let # it again. staticMarker = stdenvStaticMarker; in - lib.strings.sanitizeDerivationName ( + sanitizeDerivationName ( if attrs ? name then attrs.name + hostSuffix else @@ -953,10 +959,10 @@ let (overlappingArgs == { }) || throw ( let - errors = lib.concatMapStringsSep "\n" ( + errors = concatMapStringsSep "\n" ( name: - " - ${name}: in `env`: ${lib.generators.toPretty { } env'.${name}}; in derivation arguments: ${ - lib.generators.toPretty { } derivationArg.${name} + " - ${name}: in `env`: ${toPretty { } env'.${name}}; in derivation arguments: ${ + toPretty { } derivationArg.${name} }" ) (attrNames overlappingArgs); From 1aea84e9f7dd54f2a0ce7e1bd60af72b5b8dc803 Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Sat, 9 May 2026 20:34:07 -0400 Subject: [PATCH 12/12] stdenv.mkDerivation: inherit all builtins --- pkgs/stdenv/generic/make-derivation.nix | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index d5272a522b05..7df90e856846 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -24,9 +24,9 @@ let extendDerivation filter filterAttrs + foldl' getDev head - foldl' intersectAttrs isAttrs isBool @@ -35,6 +35,7 @@ let isList isPath isString + listToAttrs mapAttrs mapNullable optional @@ -47,7 +48,10 @@ let subtractLists toExtension toFunction + typeOf unique + unsafeDiscardStringContext + unsafeGetAttrPos warnIf zipAttrsWith ; @@ -108,7 +112,7 @@ let let prev = rattrs final; thisOverlay = toExtension f0 final prev; - pos = builtins.unsafeGetAttrPos "version" thisOverlay; + pos = unsafeGetAttrPos "version" thisOverlay; in warnIf ( @@ -312,7 +316,7 @@ let unsafeDerivationToUntrackedOutpath = drv: if isDerivation drv && (!drv.__contentAddressed or false) then - builtins.unsafeDiscardStringContext drv.outPath + unsafeDiscardStringContext drv.outPath else drv; @@ -844,7 +848,7 @@ let then if separateDebugInfo' then debugCachedOutputChecks else cachedOutputChecks else - builtins.listToAttrs ( + listToAttrs ( map (name: { inherit name; value = @@ -899,11 +903,11 @@ let pos ? # position used in error messages and for meta.position ( if attrs.meta.description or null != null then - builtins.unsafeGetAttrPos "description" attrs.meta + unsafeGetAttrPos "description" attrs.meta else if attrs.version or null != null then - builtins.unsafeGetAttrPos "version" attrs + unsafeGetAttrPos "version" attrs else - builtins.unsafeGetAttrPos "name" attrs + unsafeGetAttrPos "name" attrs ), # Experimental. For simple packages mostly just works, @@ -973,7 +977,7 @@ let n: v: assert (isString v || isBool v || isInt v || isDerivation v) - || throw "The `env` attribute set can only contain derivation, string, boolean or integer attributes. The `${n}` attribute is of type ${builtins.typeOf v}."; + || throw "The `env` attribute set can only contain derivation, string, boolean or integer attributes. The `${n}` attribute is of type ${typeOf v}."; v ) env'; in