Commit Graph

44 Commits

Author SHA1 Message Date
Sigmanificient
0bbc8dffae treewide: set meta.license on hooks 2026-05-25 13:48:20 +02:00
Bjørn Forsman
652d2da182 npmBuildHook: fix logging of the build command
The command `npm run` is wrongly logged as `npm build`. Fix it. Also,
the build script can be overridden, so log what is actually used:

  npm run $npmBuildScript [...]
2026-04-25 10:59:51 +02:00
Stefan Frijters
d66b335e05 build-support/node/build-npm-package: fix npm-config-hook.sh for structuredAttrs
Do not rely on npmDeps being exported.
2026-03-05 11:29:15 +01:00
Jörg Thalheim
ab89ffc4b1 fetchNpmDeps: rename cacheVersion to fetcherVersion
To align with pnpm tooling.
2026-01-03 18:45:33 +00:00
Winter
d028ea9cd8 npmConfigHook: suggest cache v2 when npm install fails 2025-12-31 00:37:52 -05:00
Winter
f297c444c2 npmConfigHook: always make cache writable when using cache v2 2025-12-31 00:37:52 -05:00
Winter
0b66fed9d7 buildNpmPackage: add diagnostic for cache version mismatch 2025-12-31 00:37:52 -05:00
Antoine du Hamel
3ef36b4fd0 buildNpmPackage: add support for npm-shrinkwrap.json 2025-09-22 17:50:12 +02:00
Colin
faeab3c841 buildNpmPackage: push npm_config_* options into npmHooks.npmConfigHook
these options affect npm generally, and aren't specific to our
`buildNpmPackage`. pushing these options into the `npmConfigHook` (which
is used by `buildNpmPackage`, among others) makes them available to more
packages, especially to enable cross compilation.
2025-07-07 03:08:13 +00:00
K900
226cece119 buildNpmPackage: avoid using npm config (#373220) 2025-02-09 09:29:40 +03:00
Isaac Shapira
117929b9cc buildNpmPackage: avoid using npm config 2025-01-12 16:21:53 +01:00
Doron Behar
0fc94b12c7 npmHooks.npmInstallHook: inherit nodejs when evaluating nodejsInstallExecutables
Otherwise, using the following:

```
buildNpmPackage' = buildNpmPackage.override {
  nodejs = nodejs_20;
};
```

Doesn't override the nodejs version used by the `npmInstallHook`, that
is actually used as the nodejs executable of the wrapper created by
`makeWrapper` in the default `installPhase`.
2025-01-11 23:38:36 +02:00
Silvan Mosberger
4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
lelgenio
80a2825733 npmHooks.npmInstallHook: extract npmInstall{Manuals,Executables} 2024-08-26 20:43:42 -03:00
Lily Foster
ae86a507ed npmHooks.npmInstallHook: ignore bundle deps when calculating files to install
This assumes that downstream users of `buildNpmPackage` would rather our
own built `node_modules` be copied to the output rather than only the
`bundleDependencies` specified in the `package.json` file.

Having the latter behavior seems unexpected and unintuitive, and would
not work as installing from an `npm pack` is intended to (since doing
that would not do a `rebuild` step on those dependencies and it would
skip reifying a full dependency tree).
2024-03-14 14:04:51 +01:00
Lily Foster
8999c9d930 npmHooks.npmInstallHook: ignore rather than error for missing bin/man keys in package.json 2023-12-24 22:58:32 +01:00
Lily Foster
b5ca84b450 npmHooks.npmInstallHook: only overwrite npm cache for npm pack rather than for entire hook 2023-12-05 21:53:59 +01:00
Janik
582f1e7321 Merge pull request #254420 from lilyinstarlight/fix/npm-pack-pls-😭
npmHooks.npmInstallHook: avoid script output in npm pack command
2023-11-13 22:43:57 +01:00
Doron Behar
d090cd9af4 Merge pull request #258384 from doronbehar/buildNpmPackage-makeWrapperArgs
buildNpmPackage: support makeWrapperArgs
2023-10-08 12:38:33 +03:00
Sandro
30992a8c51 buildNpmPackage: give a hint when npm prune fails
Co-authored-by: Lily Foster <lily@lily.flowers>
2023-10-07 21:53:56 +02:00
Doron Behar
fc96f6d0fd buildNpmPackage: support makeWrapperArgs 2023-10-07 14:09:05 +03:00
Lily Foster
9b2ca17abc npmHooks.npmInstallHook: avoid script output in npm pack command 2023-09-10 10:31:41 -04:00
sternenseemann
bd374243c0 npmHooks: use adjacent packages, not buildPackages
Hooks are essentially implemented as special shell packages that run on
their respective host platform. When they are used, they appear as
nativeBuildInputs (as they need to be executed as part of the build of a
package using them) so are taken from buildPackages relative to the
derivation using them.

Since the override in buildNpmPackage nullifies splicing, we take
npmHooks from buildPackages manually.

Fixes pkgsCross.ghcjs.buildPackages.emscripten and thus
pkgsCross.ghcjs.haskellPackages.ghc.
2023-09-09 17:55:37 +02:00
Robert Schütz
96e5dce777 buildNpmPackage: use installManPage 2023-08-19 10:04:00 -07:00
Pierre Bourdon
28693fb1c3 buildNpmPackage: symlink manpages to the correct output directory 2023-08-18 12:41:05 +02:00
Lily Foster
19e48f0da9 buildNpmPackage: add npmWorkspace and npmPruneFlags args 2023-06-29 07:42:25 -04:00
Winter
f9138c5ad6 npmHooks.npmInstallHook: allow disabling npm prune invocation
In some odd scenarios, `npm prune` either fails, or hangs. I have no idea
what could possibly be wrong at the moment, but let's provide an escape
hatch for packages that can still use the rest of the install hook's
functionality.
2023-05-28 00:47:54 -04:00
Winter
9117f01272 npmHooks.npmConfigHook: add npmRoot option 2023-05-21 17:26:22 -04:00
Winter
9f264f69f8 buildNpmPackage: use nodejs patch flag to work around roadblocks 2023-05-20 18:29:43 -04:00
Winter
ac35d7ea86 prefetch-npm-deps: look up hashes from cache when fixing up lockfiles 2023-04-30 10:29:46 -04:00
Artturin
4e3dcf364e treewide: makeSetupHook deps -> propagatedBuildInputs 2023-02-07 21:02:00 +02:00
Artturin
b36d9696c5 treewide: fix error: attribute 'runtimeShell' missing 2022-12-22 20:50:27 +02:00
Winter
865387061f npmHooks.npmBuildHook: fix diagnostic
Single quotes must be used when using graves in a quote, else Bash will interpret it as a command to run.

Thanks to Dimitri for catching this (8e651111b7 (commitcomment-92100762)).
2022-12-19 18:47:09 -05:00
Lily Foster
669f019379 npmHooks.npmConfigHook: make diagnostic match prefetch-npm-deps
This updates the diagnostic message for a missing package-lock.json to
match what fetchNpmDeps currently says
2022-12-19 18:47:09 -05:00
Winter
7ab5323cfb npmHooks.npmInstallHook: pass --no-save to prune 2022-11-25 15:47:05 -05:00
Winter
009a234bdd prefetch-npm-deps: repack hosted git deps
Previously, we stored the tarballs from the hosted Git providers directly in the cache. However, as we've seen with `fetchFromGitHub` etc, these files may change subtly.

Given this, this commit repacks the dependencies before storing them in the cache.
2022-11-21 15:00:08 -05:00
Winter
3d5f77f496 npmHooks.npmConfigHook: sugget specifying legacy peer deps option for all commands 2022-11-21 15:00:08 -05:00
Winter
93334f5234 npmHooks.npmInstallHook: pass install flags to prune 2022-11-21 15:00:08 -05:00
Winter
80ecb954e9 npmHooks.npmConfigHook: add diagnostic for when dependencies aren't provided 2022-11-21 15:00:08 -05:00
Winter
c0e7124bcc npmHooks.npmConfigHook: add some missing quotes around variable assignments 2022-11-21 15:00:08 -05:00
Winter
68d5b19fca npmHooks.npmConfigHook: also patch shebangs after rebuilding 2022-11-21 15:00:08 -05:00
Winter
8e651111b7 npmHooks.npmBuildHook: mention dontNpmBuild if script fails to run 2022-11-21 15:00:08 -05:00
Artturin
341e6fd558 splice.nix: start deprecating nativeDrv and crossDrv 2022-11-19 00:04:54 +02:00
Winter
16722903aa buildNpmPackage: init 2022-11-09 10:35:59 -05:00