nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 buildNpmPackage,
4 fetchFromGitHub,
5 lib,
6 nodejs,
7}:
8
9(buildNpmPackage.override { inherit nodejs; }) rec {
10 pname = "node-gyp";
11 version = "11.2.0";
12
13 src = fetchFromGitHub {
14 owner = "nodejs";
15 repo = "node-gyp";
16 tag = "v${version}";
17 hash = "sha256-NOVswjTByrQ+2z4H9wYd4YIWKhWIdgxpz2pE0dOK6qc=";
18 };
19
20 npmDepsHash = "sha256-emCYKqe6Bn1hmUq9jPDo5Nu9n43s4kb0E8lQndVtmlQ=";
21
22 postPatch = ''
23 ln -s ${./package-lock.json} package-lock.json
24 substituteInPlace gyp/pylib/gyp/**.py \
25 --replace-quiet sys.platform '"${stdenv.targetPlatform.parsed.kernel.name}"'
26 '';
27
28 dontNpmBuild = true;
29
30 # Teach node-gyp to use nodejs headers locally rather that download them form https://nodejs.org.
31 # This is important when build nodejs packages in sandbox.
32 makeWrapperArgs = [ "--set npm_config_nodedir ${nodejs}" ];
33
34 passthru.updateScript = ./update.sh;
35
36 meta = {
37 changelog = "https://github.com/nodejs/node-gyp/blob/${src.rev}/CHANGELOG.md";
38 description = "Node.js native addon build tool";
39 homepage = "https://github.com/nodejs/node-gyp";
40 license = lib.licenses.mit;
41 mainProgram = "node-gyp";
42 maintainers = with lib.maintainers; [ dotlambda ];
43 };
44}