Been working my ass off on this one. Not ready for a first release yet but will be in a few weeks. This template scratches the surface of what’s been implemented.
I’ve got a template for a starter project with my toolkit. It’s a good place to start poking around with the available builders and scraping routines.
This one generates its build plan based on a package-lock.json(v2/3)
and optionally a persistent cache ( basically a custom lockfile ).
It has a standard overlay pattern that sets it up to be composed with other projects.
I am using this at work to dynamically “hot swap” local trees and registry tarballs for ~130 projects.
mkdir -p foo;
cd foo;
nix flake init --template github:aameen-tulip/at-node-nix;
git init;
git add *;
nix build -L;
nix build .#test -L --no-link;
NPM_CONFIG_LOCKFILE_VERSION=3 \
npm i --ignore-scripts --package-lock-only foo --save-dev;
jq '.scripts.build|="foo --version|tee foo.log"' ./package.json > package.json~;
mv ./package.json~ ./package.json;
nix build -L;
# generate a cache to help skip some dynamic lock processing.
nix run .#regen-cache -- --dev --json > meta.json;
git add meta.json;
nix build -L;
# see metadata for my package.
nix eval --impure --json '.#metaSet."my-project/1.0.0".__serial'|jq;
There’s another templates#simple
for a minimal project. The tests/*/tests.nix
files are also full of example utility usage.