npm, yarn and pnpm versions that respect your environment provided node.
Assuming:
- You have a
/usr/bin/env; - You want a nix flake package of
npm,yarnorpnpm; - You want a fixed, specific version of
npm,yarnorpnpm, that is not the one bundled in yournodejspackage; - You want that the fixed version of
npm,yarnorpnpmto use the samenodethat you have on your$PATHenvironment; - You somehow locked your
nodesomewhere else:- nix flakes;
- jetpack-io/devbox;
- volta;
- pnpm;
This might fit your bill.
Pick your npm/yarn/pnpm version. Because of limitations on nixpkgs pnames, periods and the at sign are underlines.
# let's assume you need npm@9.9.2
# npm@9.9.2 -> npm-9.9.2 -> npm-9_9_2
# probably a terrible idea:
nix --extra-experimental-features 'nix-command flakes' profile install 'github:empjustine/nodejs-flake/v2#npm-9_9_2'
# a better idea
devbox add 'github:empjustine/nodejs-flake/v2#npm-9_9_2'