Closed dustin closed 2 years ago
I tried building this, and reproduced your problem. (Aside: Nix built at least two copies of GHC along the way. If you niv update haskellNix
and then use nixpkgs-unstable
, you will get more cache hits.)
As for your actual problem: I think you've hit the intersection of several unfortunate interactions. The error message has a hint:
error: Cannot find Git revision '43e8fb7e6e30e24adef11f66331ae6752642bffd' in ref 'master' of repository 'https://github.com/brendanhay/amazonka.git'! Please make sure that the rev exists on the ref you've specified or add allRefs = true; to fetchGit.
amazonka
moved to calling its default branch main
, so any revision we ask for is not going to be reachable from the master
ref.
Can we specify an alternate branch? Yes. The Pantry format does not support this, but if you read between several lines in the haskell.nix
docs, it turns out the project
function can accept a branchMap
attrset that lets you specify which branch has a particular commit.
Updating that commit is annoying. Can we fetch the repo using pantry's archive:
syntax, fetching e.g. https://github.com/brendanhay/amazonka/archive/43e8fb7e6e30e24adef11f66331ae6752642bffd.tar.gz ? No. stack-repos
(part of nix-tools
) does not support this. There is a two-year-old issue about it.
Here's a PR that built on my machine (nix build -L -f default.nix --no-link gopro.components.exes.gopro
):https://github.com/dustin/gopro/pull/13
I've updated the instructions for stack users but I personally would not use stack. It seems to create more problems than it solves, these days.
I've got a project that I build with stack, nix, and haskell.nix. This builds OK with
stack test
, but using nix-build, e.g.nix-build -A mqttd.components.exes.mqttd
fails with:Other projects dependencies are available via haskell.nix directly and automatically resolve, but the normal handling for git repos that does work for regular builds doesn't work for
nix-build
so I'm hoping someone can offer some ideas.