-
-
Save gustavderdrache/8ac3d0fdb711ffad6228ec205f8403c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
musl = (import <nixpkgs/lib>).systems.examples.musl64; | |
in | |
import <nixpkgs> { crossSystem = musl; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
pkgs = import ./musl-pkgs.nix; | |
inherit (pkgs) stdenv fetchurl; | |
get-key = key: drv: if drv?${key} then drv.${key} else drv.out; | |
get-lib = get-key "lib"; | |
get-dev = get-key "dev"; | |
sharedLibs = { | |
inherit (pkgs) openssl zlib libuv; | |
}; | |
sharedLibFlags = builtins.concatMap | |
(name: [ | |
"--shared-${name}" | |
"--shared-${name}-libpath=${get-lib sharedLibs.${name}}/lib" | |
]) | |
(builtins.attrNames sharedLibs); | |
pkgConfigPaths = | |
let | |
libs = [pkgs.icu] ++ builtins.attrValues sharedLibs; | |
in | |
builtins.map (drv: "${get-dev drv}/lib/pkgconfig") libs; | |
configureFlags = [ | |
"--prefix" "$out" | |
"--without-npm" | |
# "--fully-static" | |
"--cross-compiling" | |
"--without-snapshot" | |
"--with-intl=system-icu" | |
] ++ sharedLibFlags; | |
in | |
stdenv.mkDerivation { | |
name = "node"; | |
src = fetchurl { | |
url = "https://nodejs.org/dist/v12.13.1/node-v12.13.1.tar.xz"; | |
sha256 = "349e3a739cc26bb0975c0ada12b11933568ecbea459297fe8ae0a2acc351b192"; | |
}; | |
enableParallelBuilding = true; | |
PKG_CONFIG_PATH = builtins.concatStringsSep ":" pkgConfigPaths; | |
# nativeBuildInputs = [pkgs.removeReferencesTo]; | |
configurePhase = '' | |
addToSearchPath PATH ${pkgs.pkg-config}/bin | |
${pkgs.python2}/bin/python2 ./configure.py ${builtins.concatStringsSep " " configureFlags} | |
''; | |
outputs = ["out" "dev" "doc"]; | |
# preFixup = '' | |
# remove-references-to -t ${pkgs.stdenv.cc} $out/bin/node | |
# ''; | |
} |
Author
gustavderdrache
commented
Dec 10, 2019
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment