Closed lilyinstarlight closed 2 years ago
Okay, I think I've got this rebuilding the nodePackages
attrset without regressions with Node.js 18 (after fixing a few specific packages that hadn't been rebuilding properly before the update but still "built")
This should be ready for review/merge and I will be making a companion PR in nixpkgs in a few that brings the nodePackages
attrset up to using the latest LTS rather than being pinned to nodejs-14_x
Opened PR in nixpkgs as NixOS/nixpkgs#193337
Ok, nice contribution! I'll merge it
What version of node2nix is coming out as?
Lockfile v2 mostly just has a bit of extra metadata and all dependencies are hoisted to the top-level with path-specific keys in a new lock value called "packages". This update emits enough of the format that NPM v7+ seem to be happy enough with it and does not try to rewrite it and cause
ENOTCACHED
errors with the sandbox.As of NPM v7+, it no longer links bins for the top-level project automatically unless a global install is selected1 (and is not a problem specific to node2nix2). Given a global install would cause more problems than it would solve, I added a simple script to perform the linking ourselves and instructed
npm install
to never link them for consistency.Additionally, this adds a
postRebuild
hook that can be used by packages to run extra build scripts as needed by the project before thenpm install
step prunes dev dependencies (also seems to be a new behavior of NPM v7+, but admittedly this behavior could be due to the fake lock file confusing it a little)Closes #236, closes #293, closes #294
Edit:
Marking as draft until I can get this to work completely with thenodePackages
attrset in nixpkgs