How nami installs from nixpkgs without evaluating Nix
nixpkgs is one of the largest collections of packages there is: over 140,000, built for Linux, and most of them already built. cache.nixos.org holds the results, signed. Anyone can download them.
To get one onto a computer, though, you normally need Nix, and Nix needs to evaluate. nami is a package manager that installs those same packages, byte for byte, without running Nix’s evaluator on your computer. This post is about how, and what that costs.
What installing a package takes
When you ask Nix for ripgrep, the work has two halves.
The first half turns a name into a store path. Nix evaluates nixpkgs, a large program in
the Nix language, far enough to find ripgrep’s derivation, and works out its output path:
/nix/store/<hash>-ripgrep-15.2.0. The hash comes from how the package is built, so
working it out means evaluating the build, and everything it depends on.
The second half fetches that path. Nix asks the binary cache for it, checks the signature, and unpacks it.
The second half is cheap and the same for everyone. The first half is the expensive one,
and it’s also the same for everyone: every computer evaluating the same nixpkgs revision
gets the same answer for ripgrep. That’s the part nami moves off your computer.
A catalog, evaluated once
For each nixpkgs release, nami evaluates it once, ahead of time, and writes one index:
every package’s store paths, version, description, licence and apps. Next to it are the
app icons, each package’s build definition, and every version each package has had, so
firefox@150 or nodejs: 22 can be answered too.
On your computer, nami install ripgrep is a lookup in that file. So is search, which is
why it takes milliseconds and works offline: there’s nothing to evaluate.
Who decides what firefox means
This moves trust, and it’s worth being plain about it. Whoever controls the catalog decides
what nami install firefox means. So nami only takes a catalog signed with an ed25519 key
the computer trusts. The installer adds the publisher’s key. The index carries the sha256
of every build definition and icon, so that one signature vouches for all of them. An
unsigned catalog is only accepted when you ask for it (nami update --unsigned).
The bytes themselves are still vouched for by cache.nixos.org’s key, as they are for Nix; more on that below. What the catalog adds is the mapping from names to paths, the thing your own evaluation would otherwise have produced.
Following and pinning
A channel is a small file naming the current catalog. nami records both the channel, to follow later, and the exact index it got, so a project’s lock file can pin a catalog that never changes. The last few catalogs stay on the computer, so a project pinned to an older one still finds it.
Speaking the binary cache protocol
With a store path in hand, nami downloads it itself. It speaks the binary cache protocol
directly: each path’s .narinfo lists its references and must be signed by a trusted key
(cache.nixos.org’s is built in), and each archive must match the hash in its narinfo. It’s
unpacked into a temporary folder and renamed into place.
Only once a whole closure is unpacked does nami record the paths in its own database. An interrupted install leaves nothing half there, and nami never touches a store path it didn’t register.
Why it’s still /nix/store
nami installs into /nix/store, and it has to. nixpkgs programs have /nix/store/...
written into their library paths, their ELF interpreter and their shebangs. Move them and
they stop working.
That’s also why the same bytes run on Ubuntu, Fedora, Arch or openSUSE: each package
brings its own C library and its own dependencies, and never looks in /usr/lib. Two
versions of a library are two folders, so nothing overwrites anything, nami’s packages
don’t clash with the distribution’s, and apt or dnf carry on as before.
On distributions with a read-only root, like Silverblue, the installer mounts
/var/lib/nami/nix at /nix.
Graphics
Never looking in /usr/lib has one catch: a nixpkgs app on another distribution finds no
GPU drivers, because they’re in /usr/lib. So when a package needs graphics, nami adds a
runtime with nixpkgs’ mesa, fontconfig and locales (plus the host’s NVIDIA libraries,
which must match its kernel module), linked at /run/opengl-driver, where NixOS keeps
them. The apps look there already.
Building, when there’s nothing to download
Not everything is in the cache. Unfree packages aren’t, because Hydra doesn’t build them, and neither is software you package yourself.
A nixpkgs build turns out to be quite simple at the bottom: bash, stdenv/setup, and a
set of environment variables. stdenv and the compilers are ordinary store paths in the
binary cache. So nami writes those variables itself, from the build definition in the
catalog or from a recipe, and runs nixpkgs’ own builder. Every nixpkgs hook works
unchanged.
Builds run in bubblewrap, with only their inputs visible and no network, except for downloads with a known hash. The output path is a hash of the whole job, so the same recipe gives the same path on every computer. For unfree packages, the catalog carries what’s needed to build them at exactly the paths nixpkgs gives them.
A recipe that extends: a nixpkgs package starts from that package’s build definition in
the catalog. Every input stays the nixpkgs path, so only the changed package is built.
Undo is a link
What’s on your PATH is a profile: a tree of links merging every package, plus links to
your dotfiles and the files that change renders. Every install, remove, apply or
undo makes a new one, which Nix calls a generation and nami calls a change.
The current change is one link. Switching is one atomic rename of it, so there’s never a
moment with half the old apps and half the new, and nami undo is the same rename,
backwards. It’s Nix’s idea, kept as it is.
Next to Nix
If Nix is installed, its store is its own, and nami goes through it. Downloads use
nix-store --realise, so Nix checks the signatures. What nami builds is handed to
nix-store --import. Every path nami uses gets a garbage-collector root, so
nix-collect-garbage leaves nami’s apps alone. The paths are the same byte for byte, so
nothing is downloaded twice.
nami import reads a home-manager configuration, a shell.nix, a flake’s dev shell or a
configuration.nix, writes nami files, and lists what it couldn’t convert. Nix runs on
your computer only for that, and for a tool from a repo’s flake.nix.
What it costs
Skipping the evaluator isn’t free. nami is a much smaller thing than Nix, on purpose:
- There’s no language. Your setup is YAML with a fixed set of keys. Anything that
needs more is a recipe, and
nami recipe from-urlwrites one from a project’s link (Rust, Go, Python, Node.js, Meson, CMake, autotools). What Nix’s overlays and overrides can express, nami mostly can’t. - You follow the catalog. A package is what the catalog for that nixpkgs release says it is. A fix that lands in nixpkgs reaches nami with the next catalog.
- You trust the catalog’s signer for what a name means, as above.
- x86_64 Linux only, for now.
What you get for it:
| Nix 2.35.6 | nami 0.18.7 | |
|---|---|---|
| Search all packages | 1.3 s | 11 ms |
| A new computer, three tools installed | 8.4 s | 4.3 s |
| Start a project’s tools again | 0.07 s | 8 ms |
| What you install | 114 MB | 33 MB |
The same nixpkgs from cache.nixos.org, the middle of three runs, each in a new container,
measured on November 19, 2026. The search row is nix search, which evaluates;
search.nixos.org and nix-index are a different story. The script is in the repo,
tests/bench/nami-vs-nix.sh,
so you can run it on your own computer.
Why do it at all
Nix’s results are the reason: one file that describes a computer, the same setup every time, and every change undoable. Plenty of people want those on the distribution they already run, and won’t learn a language to get them. The evaluation they’d need was already being done, the same way, on every computer. Doing it once is the whole trick.
None of this would work without nixpkgs and its binary cache: years of work by thousands of people, which nami only reads. Thank you.
nami is open source (MIT) and in alpha.
curl -fsSL https://namios.dev/install | sh
- The code: github.com/shiolabs/nami
- How it works, in full: How it works