← 返回日报
略读 预计 2 分钟

GuixPkgs: every Guix package, as a Nix flake

摘要

项目建立在作者此前的 guix-transfer 工具之上:先固定一个 Guix commit,通过 guix time-machine 导出所有包的 derivation,再批量转换成 Nix derivation,并生成索引和元数据。这样可以把完整的 Guix 包仓库暴露为一个 Nix flake,包括一些 Nixpkgs 中没有、但存在于 Guix 的软件(例如部分 Guile 生态包)。由于首次构建会重新编译 Guix 的完整 bootstrap 链路、耗时很长,项目同时提供了 Cachix 二进制缓存。作者还设想进一步用 overlay 将 Nixpkgs 中存在对应项的包替换为 Guix 版本,从而构建 “全部软件包来自 Guix” 的 NixOS 系统。

荐读理由

用 GuixPkgs 提供的 flake 加上 Cachix 二进制缓存,能直接把 Guix 特定包(比如 Guile 相关)迁移到 Nix 项目中构建,跳过从源重新编译 bootstrap 的几小时耗时

原文

GuixPkgs: every Guix package, as a Nix flake

Published 2026-06-25 on Farid Zakaria's Blog

GuixPkgs Logo

I wrote earlier about what I believe to be an absurd idea, The Guix Nix Abomination: a tool, guix-transfer, that takes any Guix derivation and rewrites it into a Nix derivation, and lets nix-daemon build it.

With this primitive in hand, I pondered what it would mean to import the entire Guix package set into Nix.

That means we could even build a flake that is all of Guix packages available for use.

Well…. Hello GuixPkgs. 🤯

Nixpkgs is famously the largest package repository in the world. GuixPkgs makes it bigger by including in the entire GNU Guix package set so you can mix and match Guix and Nixpkgs packages in the same flake.

{
  description = "A project mixing Nix and Guix";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    guixpkgs.url = "github:fzakaria/guixpkgs";
  };

  outputs = { self, nixpkgs, guixpkgs }:
  let
    system = "x86_64-linux";
    pkgs = nixpkgs.legacyPackages.${system};
    guixPkgs = guixpkgs.packages.${system};
  in {
    devShells.${system}.default = pkgs.mkShell {
      buildInputs = [
        pkgs.git        # from Nixpkgs
        guixPkgs.hello  # from Guix, via GuixPkgs
      ];
    };
  };
}
❯ nix build github:fzakaria/guixpkgs#hello
❯ ./result/bin/hello
Hello, world!

☝ Don’t forget, that hello is built from Guix’s source bootstrap, a 357-byte seed all the way up to GCC and glibc but it lands in /nix/store and behaves like any other Nix package. No guix required on the consuming side.

Is this just a joke or is there anything of value here?

Well, some packages only exist in Guix, notable many GNU Guile built software, like guile-png that are now easily available in Nix. 🤷

How does it work?

  1. Pins a Guix commit and uses guix time-machine to get derivations from that exact Guix thus decoupling the result from whatever guix-daemon version happens to be on the host.

  2. Dumps every package’s .drv and feeds them to guix-transfer --disable-tests --emit-nix-dir pkgs.

  3. Rebuilds the by-name/ index and records the Guix channel + commit + timestamp in guix-metadata.json.

Realising a Guix package under Nix recompiles Guix’s entire source bootstrap. That’s hours per closure. To skip it, GuixPkgs ships a Cachix, cachix use guixpkgs, binary cache that is included in the flake. Thank you @domenkozar for sponsoring me with extra storage. 🙏

What’s next?

We can now do some truly horrendous evil stuff. What about an overlay that replaces every package from Nixpkgs which one that exists in Guix? 😈

We can then build a NixOS machine where every package is the Guix equivalent 😱.

This was a really fun project to pursue during TacoSprint.

taco sprint group photo


Improve this page @ 9991133 The content for this site is CC-BY-SA.

Lobsters · 2 赞 · 0 评 讨论 → 阅读原文 →

这条对你有帮助吗?