mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 00:43:20 +00:00
nodejs: corepack wrappers package
This commit is contained in:
parent
8acedb7656
commit
724f6bcb77
@ -217,6 +217,10 @@ $ prefetch-npm-deps package-lock.json
|
||||
sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
|
||||
```
|
||||
|
||||
### corepack {#javascript-corepack}
|
||||
|
||||
This package puts the corepack wrappers for npm, pnpm and yarn in your PATH, and they will honor the `packageManager` setting in the `package.json`.
|
||||
|
||||
### node2nix {#javascript-node2nix}
|
||||
|
||||
#### Preparation {#javascript-node2nix-preparation}
|
||||
|
28
pkgs/development/web/nodejs/corepack.nix
Normal file
28
pkgs/development/web/nodejs/corepack.nix
Normal file
@ -0,0 +1,28 @@
|
||||
{ lib, stdenv, nodejs }:
|
||||
|
||||
let
|
||||
inherit (nodejs) version;
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "corepack-nodejs-${version}";
|
||||
|
||||
nativeBuildInputs = [ nodejs ];
|
||||
|
||||
unpackPhase = "true";
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
corepack enable --install-directory $out/bin
|
||||
# Also wrap npm
|
||||
corepack enable --install-directory $out/bin npm
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Wrappers for npm, pnpm and yarn via nodejs's corepack";
|
||||
homepage = "https://nodejs.org";
|
||||
changelog = "https://github.com/nodejs/node/releases/tag/v${version}";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ wmertens ];
|
||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||
};
|
||||
}
|
@ -10236,6 +10236,8 @@ with pkgs;
|
||||
nodenv = callPackage ../development/tools/nodenv { };
|
||||
|
||||
nodejs = hiPrio nodejs_18;
|
||||
corepack = hiPrio (callPackage ../development/web/nodejs/corepack.nix {
|
||||
nodejs = nodejs; });
|
||||
|
||||
nodejs-slim = nodejs-slim_18;
|
||||
|
||||
@ -10254,13 +10256,20 @@ with pkgs;
|
||||
nodejs-slim_18 = callPackage ../development/web/nodejs/v18.nix {
|
||||
enableNpm = false;
|
||||
};
|
||||
corepack_18 = hiPrio (callPackage ../development/web/nodejs/corepack.nix
|
||||
{ nodejs = nodejs_18; });
|
||||
nodejs_20 = callPackage ../development/web/nodejs/v20.nix { };
|
||||
nodejs-slim_20 = callPackage ../development/web/nodejs/v20.nix {
|
||||
enableNpm = false;
|
||||
};
|
||||
corepack_20 = hiPrio (callPackage ../development/web/nodejs/corepack.nix
|
||||
{ nodejs = nodejs_20; });
|
||||
# Update this when adding the newest nodejs major version!
|
||||
nodejs_latest = nodejs_20;
|
||||
nodejs-slim_latest = nodejs-slim_20;
|
||||
corepack_latest = hiPrio (callPackage ../development/web/nodejs/corepack.nix
|
||||
{ nodejs = nodejs_latest; });
|
||||
|
||||
|
||||
buildNpmPackage = callPackage ../build-support/node/build-npm-package { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user