Skip to content

Improve support for external Hackage repositories #1370

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

Merged
merged 12 commits into from
Feb 17, 2022

Conversation

hamishmack
Copy link
Collaborator

@hamishmack hamishmack commented Feb 11, 2022

This change builds on #535. repository blocks in cabal.project parsed and cabal is used to automatically downloaded them. Then hackage-to-nix is used to produce the nix required.

To make it work with restricted eval (on hydra for instance) we need to include a sha256 like this:

repository ghcjs-overlay
  url: https://input-output-hk.github.io/hackage-overlay-ghcjs
  secure: True
  root-keys:
  key-threshold: 0
  --sha256: sha256-EPlLYPmIGtxeahlOspRzwJv+60N5mqrNC2BY4jZKceE=

To find the correct sha256 put in an invalid one and attempt a build.

This change builds #535. `repository` blocks in `cabal.project` parsed and `cabal` is used to automatically downloaded them.  Then `hackage-to-nix` is used to produce the nix required.

To make it work with restricted eval (on hydra for instance) we need to include a sha256 like this:

```
repository ghcjs-overlay
  url: https://input-output-hk.github.io/hackage-overlay-ghcjs
  secure: True
  root-keys:
  key-threshold: 0
  --sha256: sha256-EPlLYPmIGtxeahlOspRzwJv+60N5mqrNC2BY4jZKceE=
```

To find the correct `sha256` put in an invalid one and attempt a build.
@hamishmack
Copy link
Collaborator Author

bors try

iohk-bors bot added a commit that referenced this pull request Feb 11, 2022
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Feb 11, 2022

try

Build failed:

@hamishmack
Copy link
Collaborator Author

bors try

iohk-bors bot added a commit that referenced this pull request Feb 11, 2022
@hamishmack
Copy link
Collaborator Author

born try-

@hamishmack
Copy link
Collaborator Author

bors try-

@hamishmack
Copy link
Collaborator Author

bors try

iohk-bors bot added a commit that referenced this pull request Feb 11, 2022
@michaelpj
Copy link
Collaborator

To make it work with restricted eval (on hydra for instance) we need to include a sha256 like this:

Can we do the same thing with the sha256map argument for those of us who don't like magic comments?

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Feb 11, 2022

@hamishmack hamishmack marked this pull request as ready for review February 14, 2022 01:55
@hamishmack
Copy link
Collaborator Author

bors try

iohk-bors bot added a commit that referenced this pull request Feb 14, 2022
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Feb 14, 2022

try

Timed out.

Copy link
Collaborator

@michaelpj michaelpj left a comment

Choose a reason for hiding this comment

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

Sorry, lots of comments 😅

This all makes me want to rewrite cabal-project-parser in something other than Nix :/ Maybe it would actually make sense to teach nix-tools a command to process cabal projects that could do some of this stuff...

@hamishmack
Copy link
Collaborator Author

This all makes me want to rewrite cabal-project-parser in something other than Nix :/ Maybe it would actually make sense to teach nix-tools a command to process cabal projects that could do some of this stuff...

It would be nice if we could have a fixed output derivation that used cabal and nix-tools to get:

  • suitable cabal home directory
  • hackage-to-nix output for extra repositories
  • source-repository-package info in JSON form
  • suitable cabal.project file to use

It is kind of annoying that cabal-install does not expose the parser for cabal.project files (would make life a little easier).

@hamishmack
Copy link
Collaborator Author

bors try

iohk-bors bot added a commit that referenced this pull request Feb 16, 2022
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Feb 16, 2022

try

Timed out.

@michaelpj
Copy link
Collaborator

It is kind of annoying that cabal-install does not expose the parser for cabal.project files (would make life a little easier).

Yeah, but even writing an ad-hoc parser in Haskell would be better than doing it in Nix 🙈

Copy link
Collaborator

@michaelpj michaelpj left a comment

Choose a reason for hiding this comment

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

Changes look great!

@hamishmack hamishmack merged commit 2576a94 into master Feb 17, 2022
@iohk-bors iohk-bors bot deleted the hkm/cabal-project-repository branch February 17, 2022 11:42
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.

2 participants