LockerGnomeTech news and nostalgia for today's technology professionals
Subscribe

Search

Hacks & Builds

trynix.dev Boots Any Nixpkgs Package in a Browser Tab, Including GUI Apps and Python 3.6.2 From 2017

The catch: the fast guest only runs aarch64 packages, so older versions fall back to a slower emulated PC, and the network goes through a relay that sees which hosts you contact.

A man in a rust corduroy shirt sits at a laptop beside a tall monitor showing three windows nested inside each other, all woven as a silk tapestry.
Illustration: LockerGnome

The front page of trynix.dev makes a promise most package managers would blush at: “Boot any package nixpkgs ever shipped, in this tab.” You pick a package and a version from 13 years of nixpkgs history. The page pulls the package and everything it depends on from cache.nixos.org into a Linux guest running in WebAssembly, then hands you a shell with the package on PATH. The page puts its own spin on the hosting bill: “Nothing runs on a server.”

GUI programs get the same treatment. Wayland and X11 programs open as windows over the terminal, and GL programs draw with your browser’s WebGL2. Sound works too, starting after your first click on the page, with a switch on the terminal’s bar to turn it off. A program that needs PulseAudio plays if you also select pulseaudio.

The try-it list reads like a junk drawer for people who run Linux. It has galculator, solitaire, mousepad, mpv, xeyes, GL gears, weston and a terminal called foot running in a window. It also has firefox, so the page that works in Firefox can launch Firefox. The page even offers a link labeled “benchmark the emulator,” which is brave of it.

The time travel is the fun part. The list includes python 3.6.2 from 2017, python 3.10 with openssl 1.1, and “two eras of hello at once.” Each spec resolves on its own to the newest build that matches, and the versions need not have coexisted in one nixpkgs. Booted side by side, each package brings its own dependencies, so a mix that never coexisted still runs. That is the first time a greeting has been backwards compatible.

Two guests sit behind the boot button, and the choice matters. The default is aarch64 on unkernel, which the page calls the fast one: it boots in under a second and starts programs several times quicker. The page also calls it new, with gaps. It only runs packages built for aarch64, which leaves out older versions, and it has no strace or gdb. The page says the GUI path “needs the aarch64 guest.”

The other guest is x86_64 on QEMU, a complete emulated PC running a stock kernel. It is slower, and the page says to pick it for an older version, an x86_64 store path, or anything that misbehaves on unkernel. So the oldest builds and the windows sit on opposite sides of one dropdown.

The resource controls read like a hypervisor’s settings, which is what they are. The guest takes memory only as programs use it, so a large guest costs nothing until something fills it. Each CPU runs in a worker of its own. The default leaves half your machine’s threads to the browser, and you can give the guest up to all of them, at most 16, its kernel’s limit.

Downloads default to on first use. The shell starts once the packages you picked are in, and their dependencies download the first time a program opens them. What a program never opens, like the compiler a library was built with, is never fetched. If you would rather wait up front, “all before the shell starts” pulls the whole closure first, so nothing a program does waits on the network afterward.

Networking runs through a Wisp relay, which sees the hosts programs connect to. Switch it off and the guest has no network device at all. You can also add extra binary caches, one per line, as a URL and its public key. They go into the page’s link with the selection, so a store path from your cachix and the key that vouches for it are one link to send. Signatures are checked against those keys as the closure is walked, and a cache has to allow cross-origin reads or the page can’t fetch from it.

The pattern here is a package manager used as a time machine. Nixpkgs keeps 13 years of builds, and the cache hands them to a browser. Expect bug reports to start arriving as links, because a link now carries the package, the version and the caches. A maintainer who gets one boots the same thing in seconds.

The aarch64 gaps are the number to watch. The page calls that guest new, and it is already the default and the only one that runs GUI programs. As more packages get aarch64 builds, the pull toward the fast guest grows, and the slow QEMU fallback shrinks to the oldest cases. Expect the gap to close from the package side, since the guest side already works.

A tab with a Linux kernel inside also changes what a demo can be. A project can ship its README with a button that boots the program, windows, sound and GL included, with no installer and no server bill. It is a lot of packages to unpack, and now they unpack where you are reading.

Close the tab gently; there’s a kernel in there.

More Hacks & Builds

Every Hacks & Builds story →