mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-21 12:38:41 +03:00
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 ({
|
||||
unpackPhase = "true";
|
||||
|
||||
@ -17,10 +26,13 @@ stdenv.mkDerivation ({
|
||||
|
||||
buildPhase = ''
|
||||
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
|
||||
'';
|
||||
|
||||
buildNativeInputs = neededNatives;
|
||||
buildInputs = nativeDeps;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir $out
|
||||
|
@ -990,6 +990,7 @@ let
|
||||
|
||||
nodePackages = recurseIntoAttrs (import ./node-packages.nix {
|
||||
inherit pkgs stdenv nodejs fetchurl;
|
||||
neededNatives = [python] ++ lib.optional (lib.elem system lib.platforms.linux) utillinux;
|
||||
});
|
||||
|
||||
ldns = callPackage ../development/libraries/ldns { };
|
||||
|
@ -1,8 +1,9 @@
|
||||
{ pkgs, stdenv, nodejs, fetchurl }:
|
||||
{ pkgs, stdenv, nodejs, fetchurl, neededNatives }:
|
||||
|
||||
let self = {
|
||||
buildNodePackage = import ../development/web/nodejs/build-node-package.nix {
|
||||
inherit stdenv nodejs;
|
||||
inherit stdenv nodejs neededNatives;
|
||||
inherit (pkgs) runCommand;
|
||||
};
|
||||
|
||||
patchLatest = srcAttrs:
|
||||
|
Loading…
Reference in New Issue
Block a user