我想将 nixpkgs 固定到一个非常新的修订版,例如 Haskell LTS-12.9 或其他东西。我想将 nix-build 用于 MacOS(达尔文)构建。
问题是大多数 Haskell 包都没有二进制缓存,并且构建需要很长时间才能完成(在 MacOS 上)。
我如何才能找到“最佳”的 nixpkgs 修订版,该修订版足够新,可以包含我需要的软件版本,但又足够旧,可以用于 Linux 和 MacOS 的二进制缓存?
最佳答案
您可以找到 nixpkgs 的缓存版本 right here on the HowOldIs app.
您可能希望使用 nixpkgs-18.09-darwin
的修订版。或 nixpkgs-unstable
.
然后你可以像这样获取 nixpkgs
builtins.fetchGit {
name = "nixpkgs";
url = "https://github.com/nixos/nixpkgs.git";
rev = "6ec64973bc3a48b0c54d11c782e8b88b550a8eab";
ref = "release-18.09";
})
ref
当修订不在默认分支下时需要属性 - 通常是 master
.备注 in the Nix manual描述如下:
Note: It is nice to always specify the branch which a revision belongs to. Without the branch being specified, the fetcher might fail if the default branch changes. Additionally, it can be confusing to try a commit from a non-default branch and see the fetch fail. If the branch is specified the fault is much more obvious.
我想这种行为是受到 Git 协议(protocol)中的一种解决方法的启发,如果我没记错的话,您只能指定 refs 进行获取,而不能指定任意提交。
关于macos - 如何找到构建 macos/darwin 二进制缓存的 nixpkgs 修订版?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52421987/