input-output-hk / haskell.nix

Alternative Haskell Infrastructure for Nixpkgs
https://input-output-hk.github.io/haskell.nix
Apache License 2.0
557 stars 240 forks source link

Support all of the package locations that Stack (Pantry) does #1188

Open funketh opened 3 years ago

funketh commented 3 years ago

I was using haskell.nix via flakes and it doesn't seem to accept commit tags from other branches than head which stack would accept.

I think this is caused by not using allRefs = true: https://github.com/NixOS/nix/pull/3814

The second inconsistency I encountered was that stack/pantry accepts tags pointing at forks that aren't merged yet (but have a PR). When using haskell.nix I'm required to always use the URL of the fork.

I would have assumed that haskell.nix accepts the exact same set of package specifications that stack does but I'm guessing these inconsistencies are caused by haskell.nix using the builtin nix tools instead of stack or pantry itself.

Disclaimer: I encountered these issues late at night yesterday and didn't try to reproduce them yet but here are the excerpts in question that didn't work for me:

extra-deps:
# the commit points to branch ghc-9.0.1 and not head
- github: mokus0/th-extras
  commit: 57a97b4df128eb7b360e8ab9c5759392de8d1659
# the commit actually points to a fork and not haskell-numerics/random-fu (but stack accepts this)
- github: haskell-numerics/random-fu
  commit: 2d38294582ba211df6a5a2b7f7a2c5e71038b0e7

I had to change them to this:

extra-deps:
# I had to fork the fork and merge into the head branch in my fork...
- github: funketh/th-extras
  commit: 57a97b4df128eb7b360e8ab9c5759392de8d1659
# I had to use the url of the fork:
- github: funketh/random-fu
  commit: 2d38294582ba211df6a5a2b7f7a2c5e71038b0e7
TeofilC commented 3 years ago

I've also run into the issue with branches. For me, setting nix-sha256 in the stack.yaml file fixed this, eg:

- github: funketh/random-fu
  commit: 2d38294582ba211df6a5a2b7f7a2c5e71038b0e7
  # nix-sha256: shagoeshere

After that it was happy to fetch from non HEAD branches

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.