Every package is already installed
Every package is already installed
所有软件包都已安装完毕
tl;dr; omnibin is a FUSE filesystem that puts every binary nixpkgs ever shipped on your $PATH. Nothing is installed. Nothing needs building. 0 bytes on disk until something actually reads a file. 😈 It’s 2026, why am I still installing packages individually?
简而言之,omnibin 是一个 FUSE 文件系统,它将 nixpkgs 历史上发布过的每一个二进制文件都放入了你的 $PATH 中。无需安装,无需构建。在实际读取文件之前,磁盘占用为 0 字节。😈 现在已经是 2026 年了,为什么我还在一个个地安装软件包?
Yes, I am a little inspired after watching DHH’s keynote at RailsConf 2026. I feel the same way about package management. Why must I go through the ritual of adding a package to my configuration.nix, running nix-shell or succumb to the hellscape of nix-env -iA. Nix gives us the power of having packages installed side-by-side without conflict. Why do I have to pick which ones I want to install? Why can’t I just have them all? What if the machine just had all of them?
是的,在观看了 DHH 在 RailsConf 2026 上的主题演讲后,我深受启发。我对软件包管理的看法也是如此。为什么我必须经历将软件包添加到 configuration.nix、运行 nix-shell 或屈服于 nix-env -iA 这种地狱般的仪式?Nix 赋予了我们并排安装软件包且互不冲突的能力。为什么我非要挑选安装哪些?为什么不能全都要?如果机器里已经有了所有软件包会怎样?
That is over fifty thousand top-level binaries available on my $PATH, from 2013 to 2026 built by Nixpkgs, available on-demand, without installing anything. This is the magic 🧙♂️ of Nix, but it’s not restricted to Nix. Everyone seems to still love Docker and OCI, why am I still picking which base image to use? Why can’t I just have them all?
我的 $PATH 中有超过五万个顶级二进制文件,它们由 Nixpkgs 从 2013 年构建到 2026 年,无需安装即可按需使用。这就是 Nix 的魔力 🧙♂️,但它并不局限于 Nix。似乎每个人仍然钟爱 Docker 和 OCI,为什么我还在纠结该用哪个基础镜像?为什么不能全都要?
Is this the ultimate agent harness? It’s a container with everything in it, right from the start. Try it at fmzakari/omnibin.
这是终极的 AI Agent 载体吗?这是一个从一开始就包含所有内容的容器。欢迎在 fmzakari/omnibin 尝试。
Of course, I cannot forget our NixOS friends. You no longer have to curate your environment.systemPackages or home.packages, you can just have them all.
当然,我不会忘记我们的 NixOS 用户。你不再需要精心维护 environment.systemPackages 或 home.packages,你可以直接拥有所有软件包。
What is “package management” if every package is already installed?
如果所有软件包都已经安装好了,那“软件包管理”还有什么意义?
What is this sorcery?
这是什么魔法?
Turns out that Hydra writes a .ls file next to every single narinfo on cache.nixos.org that describes the contents of the archive as JSON. That metadata turns out to be the perfect index for a FUSE filesystem that can lazily fetch the NARs from the cache and unpack them on-demand. 🤓
原来 Hydra 会在 cache.nixos.org 上的每一个 narinfo 旁边写入一个 .ls 文件,以 JSON 格式描述归档文件的内容。事实证明,这些元数据是 FUSE 文件系统的完美索引,它能够从缓存中懒加载(lazily fetch)NAR 文件并按需解压。🤓
None of this would mean anything without nixpkgs-multiverse, which already resolves any (attribute, version) in nixpkgs history to the store path Hydra built for it on cache.nixos.org. When you combine the two, you get a filesystem that can answer the question “where is python3@3.6.2” and then fetch it from the cache and unpack it for you, all without ever having to install it.
如果没有 nixpkgs-multiverse,这一切都毫无意义。它已经将 nixpkgs 历史中的任何(属性,版本)解析为 Hydra 在 cache.nixos.org 上构建的存储路径。将两者结合起来,你就得到了一个文件系统,它能回答“python3@3.6.2 在哪里”的问题,然后从缓存中获取并为你解压,全程无需安装。
Do not ls the tree
不要对目录执行 ls
Agents are “a thing”. Making them useful is a thing. Making them useful without installing anything is a thing. If your agent tried to ls /omnibin/bin and stat every single entry, it would have a really bad time. There are 881,933 binaries in the tree, and it would take a long time to stat them all.
AI Agent 是个热门话题。让它们变得有用是一回事,让它们在不安装任何东西的情况下变得有用又是另一回事。如果你的 Agent 尝试对 /omnibin/bin 执行 ls 并查看(stat)每一个条目,那将会是一场灾难。目录树中有 881,933 个二进制文件,查看它们全部的状态需要很长时间。
To help the agents out a bit, ls /omnibin/bin lists only the bare names, one per executable, each resolving to the newest package that provides it. The versioned forms all resolve, but they are not listed. For everything else there is the index, which is sitting right there in the mount.
为了给 Agent 提供一点帮助,ls /omnibin/bin 只列出裸名称(每个可执行文件一个),每个名称都解析为提供该文件的最新版本。带版本号的形式虽然可以解析,但不会被列出。对于其他所有内容,你可以使用挂载点中提供的索引数据库。
Lastly, there is a /omnibin/README.md whose entire job is to tell whatever is exploring the filesystem to stop exploring the filesystem and query the database instead. 🤖
最后,/omnibin/README.md 的唯一作用就是告诉任何正在探索该文件系统的人:停止探索,转而查询数据库。🤖
What’s the catch?
有什么代价吗?
At this point it should be obvious, but you pay for this on startup for the first access. The first run took 2.7 seconds to fetch the NARs and unpack them, the second run was instantaneous because the store paths were already present. Other than that? Not really, which is pretty amazing. For any long-lived machine, you would expect your /nix/store to already be warmed up with the packages you need, so the first access penalty is not a big deal.
此时你应该已经明白了,你需要在第一次访问时付出一点代价。第一次运行花费了 2.7 秒来获取并解压 NAR 文件,第二次运行则是瞬时的,因为存储路径已经存在。除此之外还有什么吗?其实没有了,这非常令人惊叹。对于任何长期运行的机器,你的 /nix/store 应该已经预热了你需要的软件包,所以首次访问的延迟并不是什么大问题。
I remember one of the first things that blew my mind and sold me on Nix, was seeing a demo by @burke on comma. The capability to test a package, at a single nixpkgs revision, without “installing it”; revolutionary! I believe this to be a spiritual successor and I hope to imbue others with the same sense.
我记得当初让我对 Nix 彻底折服的第一件事,就是看到 @burke 关于 comma 的演示。那种无需“安装”即可在特定 nixpkgs 版本下测试软件包的能力,简直是革命性的!我相信这是它的精神续作,我也希望将这种感受传递给其他人。