Any Nix package, live in the browser

Sep 07, 2026 12:00 AM - 1 week ago 4

tl;dr Try it astatine https://trynix.dev. Click hello, aliases python 3.6.2 from 2017, aliases two eras of hullo astatine once, aliases a package that exists successful nary nationalist cache. A Linux instrumentality boots successful the tab and you get a ammunition pinch those Nix packages connected PATH.

This is my magnum opus of Nix work.

I knew each the ideas I person been creating were building blogs for thing greater: nixpkgs-multiverse indexed each type of each package nixpkgs ever shipped, grail taught it type ranges and omniflake allowed adding complete sixteen 1000 flakes from a azygous input.

The crazy penetration I had lately was the craziness of the “fast-mode” of the nixmultiverse.com, which lets you skip information and spell consecutive to the shop path. This lets you leverage the amazingness of Nix without having to woody with the complexity of information and building. You tin conscionable inquire for a package and get the nonstop shop way that Hydra built for it, astatine immoderate type it ever had.

If we person the produced binaries, we tin tally them. And if we tin tally them, we tin tally any of them, successful a browser tab, pinch thing installed connected the big machine.

Welcome to trynix, a browser-based Nix package runner. You tin browse the complete history of nixpkgs, complete 310,083 package versions, and tally immoderate of them11It is simply a serial console, truthful thing graphical. The instrumentality boots to a shell, and you tin tally immoderate command-line programme successful the store.  successful a Linux instrumentality that boots successful your tab. It is simply a Nix shop successful memory, a Linux kernel successful WebAssembly, and a terminal emulator successful the page.

Screencast: searching nixpkgs for pfetch, picking a version, and booting it to a ammunition successful the browser

This is bonkers! 🤯 We tin footwear the VM pinch the store-path closure wrong seconds. Nothing is pre-installed: search, prime a version, boot, tally it.

The craziest part? We are not restricted to the nationalist cache. You tin stock a shop way you built yourself, and anyone tin footwear it successful their browser tab. The only request is that the cache is served pinch access-control-allow-origin: *, which GitHub Pages does for free22I was a small amazed to study that GitHub Pages tin activity arsenic a binary cache. It is conscionable a fixed record server, and it serves access-control-allow-origin: * connected each file. That is each that is needed to make a Nix shop way disposable to trynix. , truthful does Cachix and obviously cache.nixos.org arsenic well.

In a unbelievable twist of fate, I had really requested 5 years agone for cache.nixos.org to service access-control-allow-origin: * via issue#156 to make it imaginable to query the cache from an OpenAPI specification I had implemented. Thank you universe. 🙏

This nexus boots a VM pinch a store-path served from Github Pages of a modified GNU hello. This is simply a shop way that does not beryllium connected cache.nixos.org and yet it boots successful your browser tab.

alt text

§Making the pieces fit

Since we tin entree store-paths from caches that service access-control-allow-origin: *, that makes the browser a morganatic Nix client.

The missing portion the browser lacked was location to run the binaries since they store-paths are either x86-64 aliases aarch64 ELF executables.

Standing connected the shoulders of giants, we tin tally a Linux kernel successful WebAssembly. This intends we tin footwear a existent x86_64 kernel wrong our browser tab. Give that kernel a filesystem containing a Nix store. All that’s near knowing which store-paths to fetch, which we beautifully solved pinch nixpkgs-multiverse. 🤌

trynix cluster_browser your browser tab page the page mv nixpkgs-multiverse attr + type → shop path page->mv which path? cache cache.nixos.org narinfo + NARs page->cache closure store nix store in memory vm qemu-wasm x86_64 Linux store->vm 9p term your shell vm->term cache->store unpacked

I person to support reminding myself: location is nary server successful the supra picture, the web-page is purely fixed files and everything other is simply a publically accessible cache. It is simply a virtual instrumentality that exists only wrong your tab. The eventual embodiment of Erase your darlings.

Since this is Nix, we get the simplicity of managing aggregate versions of the aforesaid package. You tin footwear two versions of hello successful 1 machine, and they will not conflict because each binary names its ain limitations by absolute way (RUNPATH) down to the loader and libc.

Once the VM is already started, you tin adhd much store-paths to it while it’s running. This is nary different than adding much paths to your ain /nix/store connected your laptop. No reboot, aliases dnf install, aliases apt-get install, the tract fetches the closure and adds it to the store.

§It has to consciousness instant

Booting a kernel nether emulation is slow, and contempt the amazingness of the idea, nary 1 would usage it if it took 30 seconds to get a shell.

The tract employs immoderate neat tricks to make it consciousness instant. The tract pre-fetches the motor and the VM snapshot successful the background, truthful by the clip you click a link, you person already downloaded it.

The tract besides ne'er boots the VM from scratch. It resumes. A instrumentality is booted once, up of time, connected a autochthonal build of the aforesaid QEMU, and paused astatine the infinitesimal earlier it mounts the shop which is past saved to a snapshot.

Subsequent visits to the tract person the motor and snapshot already successful the browser cache, truthful the only point that has to beryllium fetched is the closure of the store-path you asked for. This makes each consequent sojourn consciousness overmuch faster.

1980-01-01T00:00:00+00:00 image/svg+xml Matplotlib v3.10.5, https://matplotlib.org/ 0 2 4 6 8 python3 ripgrep hello 7.5 4.3 4.2 3.5 1.7 1.5 seconds to a shell visit first visit revisit

I person to springiness a batch of in installments to LLMs present for helping find a batch of the capacity opportunities and bottlenecks. What first started arsenic a “neat idea” turned into an incredibly usable task pinch their help.

Despite each the capacity work, it is still not instant. It is accelerated capable to beryllium usable, but it is not instant. Execution of a binary is still slow, because it is moving nether emulation. The first clip you tally a binary, it is translated from x86_64 to WebAssembly and that takes time. Subsequent runs are faster, because the translator is cached successful memory.

Lastly, we person an upper-bound connected the size of the closure we tin fetch. The full closure has to fresh successful tab memory, which is group to a difficult limit of ~1.5GiB arsenic of now and WebAssembly has a difficult limit of 4GiB arsenic it is simply a 32-bit reside space.

§More than a parlor trick

The demo is intelligibly nosy and impressive, but is it much than a parlor trick? I person been reasoning of endless ideas of ways successful which this could beryllium a caller measurement to usage and leverage Nix.

Reviewing a propulsion petition by utilizing the software. If your CI already pushes to a cache, for illustration Cachix, and if you usage Nix, past a PR has produced existent artifacts by the clip a quality looks astatine it. A bot tin time off a nexus that boots precisely those artifacts. The reviewer does not clone, does not build, does not spot a screenshot. They click, and tin instantly trial retired the software. “Does this hole the bug?” stops being a thought experiment.

Agent Artifacts. Agents tin nutrient Nix shop paths arsenic artifacts, and those artifacts tin beryllium shared pinch humans aliases different agents. A bot tin nutrient a shop path, and different bot tin footwear it successful a browser tab and tally tests against it.

Bug reports that transportation their ain environment. “Works connected my machine” is simply a URL now for reproduction.

Documentation you tin run. A tutorial that names a instrumentality type tin nexus a ammunition pinch that nonstop type connected PATH, pinned forever, pinch nary instal measurement opinionated betwixt a scholar and the first command.

Archaeology. You tin tally historical versions of package and research their behavior. You tin tally a type of Python from 2017 and spot what it does, aliases a type of hullo from 2005 and spot really it differs from today. This was already imaginable pinch Nix, but now you tin do it successful the browser.

The root is astatine github.com/fzakaria/trynix. The Nix cache has softly served an unfastened CORS header for years, waiting to beryllium abused used. Go footwear thing old.

More