hn.today

Nixpkgs for the Front End Impaired

fzakaria.com3 points0 comments
Screenshot of Nixpkgs for the Front End Impaired

Jinx is a transpiler that turns Nix expressions into TypeScript while preserving Nix’s lazy evaluation and derivation behavior. Its purpose is to make nixpkgs - the large, decades-old collection of package definitions and build fixes - usable from other tools and languages without rebuilding that package ecosystem from scratch. The project has compiled all 231,777 nixpkgs attributes into a matching TypeScript module tree. In tests against Nix’s evaluator across three platforms, 229,063 attributes produced identical derivation paths; the remaining 2,714 failed in both evaluators for reasons such as unsupported platforms or packages marked broken or insecure. Jinx evaluation itself does not write to the Nix store, but it can generate derivations that Nix can build.

The main value is access to nixpkgs through TypeScript’s ecosystem: developers can inspect packages in a REPL, use editor completion and type checking, profile evaluations, debug Nix source with breakpoints, write tests, and define TypeScript packages that depend on nixpkgs. Because TypeScript runs in modern browsers, the compiled package tree can also be explored in a browser without installing Nix. This is not a performance improvement: warm evaluations take roughly 2.5 to 5 times longer than Nix, with higher memory use, and first-time compilation adds further overhead. The argument is that this cost is acceptable if it opens nixpkgs to new tools and experiments while retaining the exact derivation paths on which Nix builds depend.

Read on fzakaria.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.