From ee9a623f897b154ddce0178e1c7daa9793fc14ab Mon Sep 17 00:00:00 2001 From: Bryan Lai Date: Wed, 24 Jul 2024 21:56:13 +0800 Subject: [PATCH] nodejs: use .finalPackage for ease of overriding Previously, the nodejs `passthru.pkgs` attribute refers to the package fixed point derived in the current context, without considering potential overrides to the main nodejs package. This is fixed here with the `.finalPackage` attribute, which refers to the final package fixed point, after potential overrides. For example, previously, after overriding nodejs with `nodejs.override`, `nodejs.pkgs` would still refer to the original package, instead of the overridden one. After this fix, `nodejs.pkgs` would be correctly based on the overridden `nodejs` package. --- pkgs/development/web/nodejs/nodejs.nix | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pkgs/development/web/nodejs/nodejs.nix b/pkgs/development/web/nodejs/nodejs.nix index 9c7a2ee7ef098..213d8e4b4831e 100644 --- a/pkgs/development/web/nodejs/nodejs.nix +++ b/pkgs/development/web/nodejs/nodejs.nix @@ -44,7 +44,13 @@ let (builtins.attrNames sharedLibDeps); extraConfigFlags = lib.optionals (!enableNpm) [ "--without-npm" ]; - self = stdenv.mkDerivation { + + package = stdenv.mkDerivation (finalAttrs: + let + /** the final package fixed point, after potential overrides */ + self = finalAttrs.finalPackage; + in + { inherit pname version; src = fetchurl { @@ -235,5 +241,5 @@ let }; passthru.python = python; # to ensure nodeEnv uses the same version - }; -in self + }); +in package