When using cabal2nix I can download from Github like so:
cabal2nix
cabal2nix https://github.com/MaxGabriel/u2f > u2f.nix
Is there a way to also specify a branch?
There isn't, but, if you feel like improving it, this looks like a starting point.