Skyler Turner | e706a2d | 2022-01-13 19:44:28 +0000 | [diff] [blame] | 1 | let |
| 2 | version = "17.3.0"; |
| 3 | in { nixpkgs ? import <nixpkgs> {}, stdenv }: { |
| 4 | inherit version; |
| 5 | |
| 6 | name = "nodejs-${version}"; |
| 7 | src = nixpkgs.fetchurl { |
| 8 | 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 |
| 9 | }; |
| 10 | |
| 11 | # Dependencies for building node.js (Python and utillinux on Linux, just Python on Mac) |
| 12 | buildInputs = with nixpkgs; [ xcbuild binutils-unwrapped patchelf glib python37 ] ++ stdenv.lib.optional stdenv.isLinux utillinux; |
| 13 | nativeBuildInputs = with nixpkgs; [ autoPatchelfHook ]; |
| 14 | |
| 15 | installPhase = '' |
| 16 | echo "installing nodejs" |
| 17 | mkdir -p $out |
| 18 | cp -r ./ $out/ |
| 19 | ''; |
| 20 | |
| 21 | meta = with stdenv.lib; { |
| 22 | description = "Event-driven I/O framework for the V8 JavaScript engine"; |
| 23 | homepage = "https://nodejs.org"; |
| 24 | license = licenses.mit; |
| 25 | }; |
| 26 | |
| 27 | passthru.python = nixpkgs.python37; |
| 28 | } |