Skip to content

Commit

Permalink
nodejs/importNpmLock: init source overrides option (NixOS#338973)
Browse files Browse the repository at this point in the history
  • Loading branch information
adisbladis authored Oct 22, 2024
2 parents eae7121 + 34b7d20 commit 174ae77
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkgs/build-support/node/import-npm-lock/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ lib.fix (self: {
# Example: { "node_modules/axios" = { curlOptsList = [ "--verbose" ]; }; }
# This will download the axios package with curl's verbose option.
, fetcherOpts ? {}
# A map from node_module path to an alternative package to use instead of fetching the source in package-lock.json.
# Example: { "node_modules/axios" = stdenv.mkDerivation { ... }; }
# This is usefull if you want to inject custom sources for a specific package.
, packageSourceOverrides ? {}
}:
let
mapLockDependencies =
Expand All @@ -94,10 +98,10 @@ lib.fix (self: {
mapAttrs
(modulePath: module:
let
src = fetchModule {
src = packageSourceOverrides.${modulePath} or (fetchModule {
inherit module npmRoot;
fetcherOpts = fetcherOpts.${modulePath} or {};
};
});
in
cleanModule module
// lib.optionalAttrs (src != null) {
Expand Down

0 comments on commit 174ae77

Please sign in to comment.