Nix Recipe: Setup Nodejs

This is a nix recipe for building and running nodejs in a virtual nix environment. In your project folder, create a new file nodejs.nix and add following: { 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"}....

March 6, 2020 · 2 min · wilspi