jinx is a transpiler that converts Nix expressions into TypeScript modules and has been used to compile the entire nixpkgs tree - 231,777 attributes - into a TypeScript program. Each .nix file becomes a .ts module that preserves Nix semantics (including laziness via explicit thunks) so that evaluating an attribute in Node or a browser produces the exact same .drv and drvPath strings that Nix would generate. The system writes nothing to /nix/store during evaluation; jinx can instantiate .drv closures and hand them to nix-store realize for building. The compiled tree is published, and the runtime runs on Node 24 or in browsers with no native dependencies.
Verification shows strong fidelity: across x86_64-linux, aarch64-linux and aarch64-darwin, 229,063 attributes produced identical drvPaths, with 2,714 failing on both sides due to attributes Nix refuses to evaluate. Performance is slower - warm evaluations ~2.5-5× slower and cold runs 3-10× slower, with 2-4× higher memory use because of thunk overhead - but usable. The TypeScript representation unlocks practical benefits: V8 profiling and flamegraphs, LSP-powered editor completion and type checking, source-mapped breakpoints for stepping through Nix, unit testing, writing interoperable packages in TypeScript, and in-browser exploration. The source and compiled nixpkgs tree are on GitHub; the author notes AI-assisted coding in the implementation.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.