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

support cabal.project source-repository-package commit #1416

Closed
wants to merge 1 commit into from
Closed

support cabal.project source-repository-package commit #1416

wants to merge 1 commit into from

Conversation

brainrake
Copy link

Support using a commit hash instead of tag on cabal.project source-repository-package.

If one puts the commit has in the tag: field instead, cabal-project-parser works, but cabal crashes while trying to download a tag instead of a commit.

@brainrake brainrake marked this pull request as ready for review March 30, 2022 21:18
@hamishmack
Copy link
Collaborator

Is there an example somewhere of the problem this fixes?

@brainrake
Copy link
Author

Anytime commit is used in source-repository-package in cabal.project.
Here's a demo:
https://github.com/brainrape/haskell-nix-source-repository-package-commit-example

If I remove --sha256 and build with nix develop --impure I get

fetching Git repository 'https://github.com/input-output-hk/cardano-prelude'fatal: couldn't find remote ref refs/heads/c7fc9fba236972c27a55e0f3d34c2758cf616bfc

Maybe that should be looked into as well.

@brainrake
Copy link
Author

Hm, looks like cabal accepts commits in tag: as well, I'll need to look into this further.

@brainrake brainrake marked this pull request as draft March 31, 2022 17:46
@purefn
Copy link
Contributor

purefn commented Mar 31, 2022

The "couldn't find remote ref" error is tracked as #1288. The simple solution is to change ref to rev here

let drv = builtins.fetchGit { inherit (repoData) url ref; };
.

commit is not a supported attribute for source-repository-package. tag is intended to be the revision, but it was named tag to try and be VCS agnostic, which just results in confusion. Discussion of that can be found here haskell/cabal#6888.

I think your example only works by accident because the revision you've specified for commit happens to be the HEAD of the default branch. Otherwise, you would see that it is ignored.

@brainrake
Copy link
Author

Thanks for clearing that up

@brainrake brainrake closed this Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants