node-packages: ability to build npms that have native extensions
This commit is contained in:
parent
9a65507b0f
commit
baa6223904
@ -1,7 +1,16 @@
|
|||||||
{ stdenv, nodejs }:
|
{ stdenv, runCommand, nodejs, neededNatives}:
|
||||||
|
|
||||||
args @ { src, deps, ... }:
|
args @ { src, deps ? [], nativeDeps ? [], flags ? [], ... }:
|
||||||
|
|
||||||
|
with stdenv.lib;
|
||||||
|
|
||||||
|
let npmFlags = concatStringsSep " " (map (v: "--${v}") flags);
|
||||||
|
sources = runCommand "node-sources" {} ''
|
||||||
|
tar xf ${nodejs.src}
|
||||||
|
mv node-v${nodejs.version} $out
|
||||||
|
'';
|
||||||
|
|
||||||
|
in
|
||||||
stdenv.mkDerivation ({
|
stdenv.mkDerivation ({
|
||||||
unpackPhase = "true";
|
unpackPhase = "true";
|
||||||
|
|
||||||
@ -17,10 +26,13 @@ stdenv.mkDerivation ({
|
|||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
${nodejs}/bin/npm --registry http://www.example.com install ${src}
|
${nodejs}/bin/npm --registry http://www.example.com --nodedir=${sources} install ${src} ${npmFlags}
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
buildNativeInputs = neededNatives;
|
||||||
|
buildInputs = nativeDeps;
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
mkdir $out
|
mkdir $out
|
||||||
|
@ -990,6 +990,7 @@ let
|
|||||||
|
|
||||||
nodePackages = recurseIntoAttrs (import ./node-packages.nix {
|
nodePackages = recurseIntoAttrs (import ./node-packages.nix {
|
||||||
inherit pkgs stdenv nodejs fetchurl;
|
inherit pkgs stdenv nodejs fetchurl;
|
||||||
|
neededNatives = [python] ++ lib.optional (lib.elem system lib.platforms.linux) utillinux;
|
||||||
});
|
});
|
||||||
|
|
||||||
ldns = callPackage ../development/libraries/ldns { };
|
ldns = callPackage ../development/libraries/ldns { };
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
{ pkgs, stdenv, nodejs, fetchurl }:
|
{ pkgs, stdenv, nodejs, fetchurl, neededNatives }:
|
||||||
|
|
||||||
let self = {
|
let self = {
|
||||||
buildNodePackage = import ../development/web/nodejs/build-node-package.nix {
|
buildNodePackage = import ../development/web/nodejs/build-node-package.nix {
|
||||||
inherit stdenv nodejs;
|
inherit stdenv nodejs neededNatives;
|
||||||
|
inherit (pkgs) runCommand;
|
||||||
};
|
};
|
||||||
|
|
||||||
patchLatest = srcAttrs:
|
patchLatest = srcAttrs:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user