The new buildNpmPackage in nixpkgs is IMO the best thing that happened to Javascript Nix packaging in a while.
https://nixos.org/manual/nixpkgs/unstable/#javascript-buildNpmPackage
It trades off "declaratively listing all dependencies in a Nix source expression" for "actually being usable by normal humans". Slight loss in auditability but OTOH people were just packaging pre-built Javascript before because node2nix was such an unusable mess.
@delroth What was roughly the reason for node2nix being a mess?
@robryk try it and report back :)
Stuff I remember from the last time I tried using it:
- Requires vendoring parts of the projects being packaged into nixpkgs (package.json, package-lock.json)
- Requires running a code generator on updates
- node2nix itself needs updating for every new nodejs version, and that doesn't happen necessarily in sync with nodejs bumps in nixpkgs
- It's super slow.
@delroth Ah, it _doesn't_ fetch them using `npm`: https://github.com/NixOS/nixpkgs/blob/60762c6576cc8b9e2d615ea9bd8c59ffe34174a1/pkgs/build-support/node/fetch-npm-deps/default.nix