-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodejs.nix
34 lines (27 loc) · 1.03 KB
/
nodejs.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{ nixpkgs ? import <nixpkgs> {}, version, sha256 }:
let
inherit (nixpkgs) python37 utillinux stdenv autoPatchelfHook fetchurl binutils-unwrapped patchelf xcbuild;
inherit (stdenv) mkDerivation;
in
mkDerivation {
inherit version;
name = "nodejs-${version}";
src = fetchurl {
url = "https://nodejs.org/dist/v${version}/node-v${version}${if stdenv.isDarwin then "-darwin-x64" else "-linux-x64"}.tar.xz"; # this darwin/linux check doesn't work since sha is different for packages
inherit sha256;
};
# Dependencies for building node.js (Python and utillinux on Linux, just Python on Mac)
buildInputs = with nixpkgs; [ xcbuild binutils-unwrapped patchelf glib python37 ] ++ stdenv.lib.optional stdenv.isLinux utillinux;
nativeBuildInputs = with nixpkgs; [ autoPatchelfHook ];
installPhase = ''
echo "installing nodejs"
mkdir -p $out
cp -r ./ $out/
'';
meta = with stdenv.lib; {
description = "Event-driven I/O framework for the V8 JavaScript engine";
homepage = "https://nodejs.org";
license = licenses.mit;
};
passthru.python = python37;
}