Skip to content

Instantly share code, notes, and snippets.

@danielres
Last active March 8, 2024 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielres/2b4a0c93fc850832b8c5dd1ad8882a94 to your computer and use it in GitHub Desktop.
Save danielres/2b4a0c93fc850832b8c5dd1ad8882a94 to your computer and use it in GitHub Desktop.
nix shell minimal node + pnpm development environment

Replacement for nvm and other version managers.

requires:

Notes:

sudo npm install -g doesnt't work well with under nix-shell.

To install npm packages globally without sudo, change the npm global directory:

$ mkdir ~/.npm-global
$ npm config set prefix '~/.npm-global'

Add the directory to the PATH variable, so that your system knows where to find the globally installed modules:

echo "export PATH=~/.npm-global/bin:$PATH" >> ~/.profile
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = [
pkgs.nodejs
pkgs.nodePackages.pnpm
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment