Skip to content

Conversation

@hamishmack
Copy link
Collaborator

This allows source-repository-package to be downloaded and replaced in
with package: /nix/store/... by callCabalPackageToNix so that cabal
and plan-to-nix do not need to download them.

fetchRepo = repo: (pkgs.fetchgit {
url = repo.location;
rev = repo.tag;
sha256 = repo."--sha256";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially, I thought "surely fetchgit is okay if you supply a rev?". Weirdly, it's allowed with --pure-eval, but not with --restrict-eval 🤔 Maybe this is a bug? It seems like --pure-eval has a more sensible notion of what "pure" things are.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I can now see the need for this trick, but it makes me a bit sad)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might actually be a nice feature for cabal if it could check the sha256 of source-repository-package. Perhaps less important when the location is https, but when it is http it would probably be nice. It would also make sense if/when cabal source-repository-package gets tarball support.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the git sha be enough? Definitely useful for tarball support, I agree.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the git sha be enough? Definitely useful for tarball support, I agree.

I'm not sure why, but nixpkgs.fetchgit does not support using just the git sha. I don't think that is likely to change soon.

@hamishmack hamishmack force-pushed the hkm/hydra-source-repos branch 3 times, most recently from c6a5aad to 42b740a Compare July 14, 2019 04:34
@hamishmack hamishmack requested a review from angerman July 14, 2019 04:46
Copy link
Collaborator

@angerman angerman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still have mixed feelings about this. And I'm a bit suspicious about the source-repo replacement with nix. That seems something a shell script could do faster and may be even easier to read? Certainly easy to debug as it would be something that could be tried in isolation.

@hamishmack
Copy link
Collaborator Author

I still have mixed feelings about this. And I'm a bit suspicious about the source-repo replacement with nix. That seems something a shell script could do faster and may be even easier to read? Certainly easy to debug as it would be something that could be tried in isolation.

The cabal.project parsing code would be even nicer in Haskell (especially if it could reuse the code in the cabal-install package). Perhaps if we had a Haskell command that would convert the .project files to/from JSON. Then we could convert to the cabal.project to JSON, read/process it with nix and write JSON back out (and convert it back to a cabal.project file).

Could we leave replacing the cabal.project processing code with something better for another PR?

@hamishmack hamishmack force-pushed the hkm/hydra-source-repos branch 4 times, most recently from abca1ae to 627658c Compare July 16, 2019 05:42
This allows source-repository-package to be downloaded and replaced in
with `package: /nix/store/...` by callCabalPackageToNix so that `cabal`
and `plan-to-nix` do not need to download them.
@hamishmack hamishmack force-pushed the hkm/hydra-source-repos branch from 627658c to b5f1c0b Compare July 16, 2019 05:52
Copy link
Collaborator

@angerman angerman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should stop calling out hydra, it is essentially the restricted eval mode, and thus applies to anything that uses restricted eval, hydra or not.

@hamishmack hamishmack requested a review from angerman July 16, 2019 07:01
@angerman angerman changed the title Add sha256 to source-repository-packages for hydra Add sha256 to source-repository-packages for restricted eval mode Jul 16, 2019
@angerman angerman merged commit dedb91e into master Jul 16, 2019
@angerman angerman deleted the hkm/hydra-source-repos branch July 16, 2019 07:13
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.

4 participants