From 57321d2ed2f5bbe6bfc32f23a2d219db1eef84a5 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Sun, 5 May 2024 11:33:00 +0200 Subject: [PATCH] nodePackages: enable overriding src and name attrs Signed-off-by: Sefa Eyeoglu (cherry picked from commit 4549773edf119c40f3285fd46b662a5ceec2e456) --- pkgs/development/node-packages/node-env.nix | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkgs/development/node-packages/node-env.nix b/pkgs/development/node-packages/node-env.nix index bc1e36628ac8..5400fc63588e 100644 --- a/pkgs/development/node-packages/node-env.nix +++ b/pkgs/development/node-packages/node-env.nix @@ -109,7 +109,7 @@ let ); # Recursively composes the dependencies of a package - composePackage = { name, packageName, src, dependencies ? [], ... }@args: + composePackage = { name, packageName, src, dependencies ? [], ... }: builtins.addErrorContext "while evaluating node package '${packageName}'" '' installPackage "${packageName}" "${src}" ${includeDependencies { inherit dependencies; }} @@ -194,7 +194,7 @@ let # dependencies in the package.json file to the versions that are actually # being used. - pinpointDependenciesOfPackage = { packageName, dependencies ? [], production ? true, ... }@args: + pinpointDependenciesOfPackage = { packageName, dependencies ? [], production ? true, ... }: '' if [ -d "${packageName}" ] then @@ -496,7 +496,7 @@ let let extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ]; in - stdenv.mkDerivation ({ + stdenv.mkDerivation (finalAttrs: { name = "${name}${if version == null then "" else "-${version}"}"; buildInputs = [ tarWrapper python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux @@ -508,8 +508,9 @@ let inherit dontStrip; # Stripping may fail a build for some package deployments inherit dontNpmInstall preRebuild unpackPhase buildPhase; - compositionScript = composePackage args; - pinpointDependenciesScript = pinpointDependenciesOfPackage args; + # TODO: enable overriding dependencies too? + compositionScript = composePackage { inherit packageName dependencies; inherit (finalAttrs) name src; }; + pinpointDependenciesScript = pinpointDependenciesOfPackage { inherit packageName dependencies production; }; passAsFile = [ "compositionScript" "pinpointDependenciesScript" ];