Hi everyone, I am happy to announce that we (at Canva) made the
js2nix project public! The
js2nix project is yet another
lang2nix solution. We have been using it for some of our systems for more than a year and now we make it public.
- Make every npm package the first-class citizen Nix derivation.
- Codify against a full dependency tree.
- Resolve dependency cycles.
- Handle Life-cycle scripts of an npm package.
- Build npm package from local sources, ie. support workspaces.
- Expose Nix primitive, don’t force code structure.
Please follow this link GitHub - canva-public/js2nix: Node.js modules installation using Nix.
Why it was created?
It’s a known issue when Node.js project builds struggle with making the node modules installation phase scalable. We run millions of installs of node modules per workday at our CI agents and identified that the main issue is the granularity and flakiness. That is, js2nix was created to address these issues.
Why not just use what is already on the market?
In short, we haven’t found a project that can resolve all the corner cases so we had to create our own. I have to say that I was highly inspired by this project GitHub - Profpatsch/yarn2nix: Build and deploy node packages with nix from yarn.lock files.. But at the moment of the initial research, it was struggling with resolving some critical issues, like, dependency cycles and life-scripts execution. So we created an in-house version that serves our needs well.
We would love to hear your feedback!