Skip to content

Instantly share code, notes, and snippets.

@tmountain
Created November 28, 2018 17:42
Show Gist options
  • Save tmountain/6760162a11624124c987e40926ea4d62 to your computer and use it in GitHub Desktop.
Save tmountain/6760162a11624124c987e40926ea4d62 to your computer and use it in GitHub Desktop.
Travis-Whitton's-MacBook-Pro:nix traviswhitton$ cat node.nix
# This imports the nix package collection,
# so we can access the `pkgs` and `stdenv` variables
with import <nixpkgs> {};
# Make a new "derivation" that represents our shell
stdenv.mkDerivation {
name = "my-environment";
# The packages in the `buildInputs` list will be added to the PATH in our shell
buildInputs = [
# see https://nixos.org/nixos/packages.html to search for more
pkgs.yarn
pkgs.nodejs-10_x
];
shellHook = ''
export DERP="foobingo"
'';
}
Travis-Whitton's-MacBook-Pro:nix traviswhitton$ nix-shell node.nix
[nix-shell:~/Projects/nix]$ node --version
v10.12.0
[nix-shell:~/Projects/nix]$ yarn --version
1.12.3
[nix-shell:~/Projects/nix]$ exit
Travis-Whitton's-MacBook-Pro:nix traviswhitton$ yarn --version
-bash: yarn: command not found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment