Skip to content

Commit

Permalink
nodePackages: enable overriding src and name attrs
Browse files Browse the repository at this point in the history
Signed-off-by: Sefa Eyeoglu <[email protected]>
  • Loading branch information
Scrumplex committed Jun 2, 2024
1 parent 8bd9ff0 commit 4549773
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkgs/development/node-packages/node-env.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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; }}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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" ];

Expand Down

0 comments on commit 4549773

Please sign in to comment.