Node.js: Difference between revisions
Denperidge (talk | contribs) Added development environment |
m →Setup: suggest search.nixos.org instead of cli nix search |
||
| (One intermediate revision by the same user not shown) | |||
| Line 5: | Line 5: | ||
== Setup == | == Setup == | ||
Adapt or add following line to your system configuration:<syntaxhighlight lang="nix> | Adapt or add following line to your system configuration:<syntaxhighlight lang="nix> | ||
environment.systemPackages = with pkgs; [ nodejs ]; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
See | See [https://search.nixos.org/packages?&query=nodejs NixOS Package Search] for additional versions like <code>nodejs_20</code>, etc. | ||
== Development environment == | == Development environment == | ||
| Line 14: | Line 14: | ||
=== Nixpkgs example === | === Nixpkgs example === | ||
{{file|shell.nix|nix|3= | |||
{ pkgs ? import <nixpkgs> {} }: | { pkgs ? import <nixpkgs> {} }: | ||
pkgs.mkShell { | pkgs.mkShell { | ||
| Line 23: | Line 22: | ||
]; | ]; | ||
} | } | ||
}} | |||
=== Corepack example === | === Corepack example === | ||
To use specific/pinned versions of your runtime & package manager, a combination of corepack & steam-run can be used | To use specific/pinned versions of your runtime & package manager, a combination of corepack & steam-run can be used | ||
{{file|shell.nix|nix|3= | |||
{ pkgs ? import <nixpkgs> {} }: | { pkgs ? import <nixpkgs> {} }: | ||
| Line 39: | Line 38: | ||
''; | ''; | ||
} | } | ||
}} | |||
{{file|package.json|json|3= | |||
{ | { | ||
"packageManager": "pnpm@11.4.0", | "packageManager": "pnpm@11.4.0", | ||
| Line 52: | Line 51: | ||
} | } | ||
} | } | ||
}} | |||
== Packaging == | == Packaging == | ||