The new buildNpmPackage in nixpkgs is IMO the best thing that happened to Javascript Nix packaging in a while.

nixos.org/manual/nixpkgs/unsta

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

> - Requires vendoring parts of the projects being packaged into nixpkgs (package.json, package-lock.json)

Oh :/ Yes, that's terrible.

> - Requires running a code generator on updates

_code_? Do you mean something that updates whatever-the-nix-expression-reads-to-find-hashes-of-all-deps or something else?

> - node2nix itself needs updating for every new nodejs version, and that doesn't happen necessarily in sync with nodejs bumps in nixpkgs

That makes me wonder if the new setup is going to require cache hash updates when npm-the-binary is updated.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.