jinx Nix, transpiled to TypeScript

The compiled nixpkgs

fzakaria/jinx-nixpkgs is nixpkgs compiled to TypeScript, one commit per tracked nixpkgs revision. Every .nix file is a .ts module in the same place, with a source map beside it pointing back at the Nix, and the runtime the modules import is vendored under .jinx/runtime, so the tree stands alone.

Using it

The source tree is not in the repository. Put a checkout of the revision .jinx/config.json names at ./nixpkgs (a symlink to the store path is enough) and evaluate against the tree:

$ git clone https://github.com/fzakaria/jinx-nixpkgs && cd jinx-nixpkgs
$ rev=$(jq -r .nixpkgs.rev .jinx/config.json)
$ ln -s "$(nix flake prefetch github:NixOS/nixpkgs/$rev --json | jq -r .storePath)" nixpkgs
$ jinx eval ./nixpkgs -A hello.drvPath --tree .

Nothing is compiled on the way: --tree makes import resolve to the modules already there. From TypeScript, loadNixpkgs("./nixpkgs", { tree: "." }) does the same.

What a commit holds

Each revision is also a regression test for the compiler: a jinx change that lowers the parity count on any revision is a regression, and the report says which attribute and why.

Local, offline

jinx-nixpkgs is an input of jinx's flake. nix run github:fzakaria/jinx#serve serves the site with the compiled tree and the nixpkgs source from the store, so the nixpkgs page runs with no network.

Edit this page on GitHub