saved
Nixpkgs for the frontend impaired
Hraness wrote this summary from a saved copy of the source. Quotations are taken word for word from the source.
gist
Farid Zakaria introduces jinx, a transpiler that compiles Nix to readable TypeScript, and uses it to compile all 231,777 nixpkgs attributes so that each yields exactly the drvPath Nix produces. His case is that the store model, not the Nix language, is the magic, and nixpkgs’ twenty years of packaging work is what traps alternatives; translating it lets the TypeScript ecosystem profile, type-check, debug, unit-test and even run nixpkgs in a browser, at roughly three to five times Nix’s evaluation time.
ideas
- Nixpkgs is the moat. The Nix language is small enough to redesign in a weekend, but 140,000-plus building packages are not, so new evaluators and languages die starting from zero.
- Faithful translation. Each .nix file becomes a TypeScript module of the same name, with thunks wherever Nix allocates one, and jinx writes the same .drv files Nix would.
- Verified on all of nixpkgs. Across x86_64-linux, aarch64-linux and aarch64-darwin, 229,063 attributes match nix-eval-jobs exactly, 2,714 fail on both sides, and none differ.
- Tooling for free. Source maps and TypeScript types bring flame graphs, editor completion, breakpoints in stdenv, scripted queries, node:test unit tests and hand-written TypeScript packages.
- Slow but usable. Warm evaluation runs 2.5x to 5.1x slower than Nix with roughly 2x to 4x the memory, which Zakaria calls a fine start; he discloses that AI co-wrote much of the code.
quotes
“The store model is the great idea.”
“This is the graveyard where other reimplementations or forks of Nix go to die.”
“That is the key to unlocking nixpkgs in another ecosystem: the store does not know the difference.”
“an AI co-authored a lot of this software with me.”