Skip to content

Commit

Permalink
nodejs: use .finalPackage for ease of overriding
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bryango committed Jul 24, 2024
1 parent 453402b commit ee9a623
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkgs/development/web/nodejs/nodejs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -235,5 +241,5 @@ let
};

passthru.python = python; # to ensure nodeEnv uses the same version
};
in self
});
in package

0 comments on commit ee9a623

Please sign in to comment.