I'd like to pin nixpkgs to a quite fresh revision, say, Haskell LTS-12.9 or something. And I want to use nix-build for MacOS (Darwin) builds.
The problem is there is no binary cache for most of Haskell packages, and the build takes ages to complete (on MacOS).
How could I find "optimal" nixpkgs revision, which is recent enough to contain software versions I need, but old enough for binary caches to be available for Linux and MacOS?
You can find the built versions of nixpkgs on status.nixos.org
You'll probably want to use a revision of nixpkgs-18.09-darwin
or nixpkgs-unstable
.
You can then fetch nixpkgs like so
builtins.fetchGit {
name = "nixpkgs";
url = "https://github.com/nixos/nixpkgs.git";
rev = "6ec64973bc3a48b0c54d11c782e8b88b550a8eab";
ref = "release-18.09";
})
The ref
attribute is required when the revision isn't under the default branch - typically master
.
A note in the Nix manual describes it as follows:
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.
I suppose this behavior is inspired by a workaround in the Git protocol, that you can only specify refs for fetching, but not arbitrary commits, if I'm not mistaken.