Created
August 11, 2022 07:58
-
-
Save drupol/ac3dc9f89cc606a668773cb54b996857 to your computer and use it in GitHub Desktop.
Flake for NodeJS dev
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
{ | |
description = "The NodeJS development environment"; | |
inputs = { | |
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | |
flake-utils.url = "github:numtide/flake-utils"; | |
}; | |
outputs = { self, flake-utils, nixpkgs }: | |
flake-utils.lib.eachDefaultSystem | |
(system: | |
let | |
pkgs = import nixpkgs { | |
inherit system; | |
config = { | |
allowUnfree = true; | |
permittedInsecurePackages = [ | |
"nodejs-10.24.1" | |
]; | |
}; | |
}; | |
makeNodeEnv = name: node: pkgs.buildEnv { | |
inherit name; | |
paths = [ | |
node | |
pkgs.yarn | |
] ++ [ | |
pkgs.gh | |
pkgs.sqlite | |
pkgs.git | |
pkgs.gnumake | |
]; | |
}; | |
derivations = rec | |
{ | |
default = derivations.node14; | |
node10 = makeNodeEnv "node-10" pkgs.nodejs-10_x; | |
node12 = makeNodeEnv "node-12" pkgs.nodejs-12_x; | |
node14 = makeNodeEnv "node-14" pkgs.nodejs-14_x; | |
node16 = makeNodeEnv "node-16" pkgs.nodejs-16_x; | |
node17 = makeNodeEnv "node-17" pkgs.nodejs-17_x; | |
node18 = makeNodeEnv "node-18" pkgs.nodejs-18_x; | |
}; | |
in | |
{ | |
packages = derivations; | |
devShells = builtins.mapAttrs | |
( | |
name: env: pkgs.mkShellNoCC { | |
inherit name; | |
buildInputs = [ | |
env | |
]; | |
} | |
) | |
derivations; | |
} | |
); | |
} |
Hey !
I forgot about this gist :)
The idea behind this flake was to offer to my colleague the possibility to switch from one version of Node version quickly.
That's the reason why there are many entries.
Thanks for the reply. Every time I want to setup a gist it's a frantic google around for examples and this came up.
Oh really ?! How come?!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Too much going on here. Can't it be just simply one version? How do you call this?