summaryrefslogtreecommitdiff
path: root/nodejs.nix
blob: 71e8d04c423d418c1e15f216fa58b2fad9b1b9c0 (plain)
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
35
36
{ pkgs ? import <nixpkgs> {}, version, sha256 }:

  let
    inherit (pkgs) stdenv autoPatchelfHook platforms fetchurl;
    inherit (stdenv) mkDerivation lib;
  
  in mkDerivation {
    inherit version;
  
    name = "nodejs-${version}";
  
    src = fetchurl {
      url = "https://nodejs.org/dist/v${version}/node-v${version}-linux-x64.tar.xz";
      inherit sha256;
    };

    # QUESTION: put glib and autoPatchelfHook in nativeBuildInputs or buildInputs?
    nativeBuildInputs = with pkgs; [autoPatchelfHook];
    buildInputs = with pkgs; [glib];

    installPhase = ''
      echo "joe is installing nodejs"
      mkdir -p $out
      cp -R ./ $out/
    '';
  
    meta = {
      description = "Event-driven I/O framework for the V8 JavaScript engine";
      homepage = https://nodejs.org;
      license = lib.licenses.mit;
      platforms = lib.platforms.linux;
    };

    #TODO do I need this?
    #passthru.python = python2; # to ensure nodeEnv uses the same version
  }