I try to build the Haskell library hlibgit2 from source since I may have to introduce changes.
When setting up I noticed that the build fails because the library git is marked as broken. hlibgit2 however doesn’t depend on the Haskell library git.
You can see that this expression takes a git argument.
haskellPackages.callPackage naively picks haskellPackages.git to pass to this git argument, when really it should have picked the top-level git, as you’ve correctly pointed out.
You can likely fix this by making sure to pass the correct git to callCabal2nix: