Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cabal2nix tries to fetch hackage revisions even if already present in the source #550

Open
sternenseemann opened this issue May 2, 2022 · 2 comments
Labels
Milestone

Comments

@sternenseemann
Copy link
Member

sternenseemann commented May 2, 2022

Consider the servant-cassava.cabal file: It has a Hackage x-revision field checked in the repository which, interestingly, was never applied on Hackage.

cabal2nix, however, recognizes this and sets the revision and even editedCabalFileSha256 (I have no clue yet where this hash comes from). Arguably, when cabal2nixing a revision of a git repo where the modifications of the revision are checked in, it doesn't make sense to fetch the revision from Hackage (it may even fail as in this case). Fixing this will require careful checking if there are any cases where this would be desireable and, most importantly, how this works exactly in all-cabal-hashes, so we don't regress hackage2nix.

Another question is of course if x-revision entries should even be checked in, but seeing as the have been, maybe not that important. Workaround is of course to overrideCabal { revision = null; editedCabalFileSha256 = null; }.

@sternenseemann sternenseemann added this to the 2.20.0 milestone May 20, 2022
plt-amy added a commit to obsidiansystems/cli-extras that referenced this issue Jul 19, 2022
@Ericson2314
Copy link
Member

I don't think the old behavior is ever desirable. When cabal2nix is given source code it shouldn't be doing IO to get other source code, full stop. That just doesn't make sense at all. In general, don't mix IO with business logic like that too.

@sternenseemann
Copy link
Member Author

There is some nuance to it, since there is a difference between being given a cabal file and being given source code. This difference is already present in the fetcher code, so I think we just need to mirror it for the revision logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants