-
Notifications
You must be signed in to change notification settings - Fork 247
Add shellFor multi-package development environments #121
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do a more thourough review later. A lot of moved code.
test/shell-for/default.nix
Outdated
let | ||
pkgSet = mkStackSnapshotPkgSet { | ||
resolver = "lts-12.21"; | ||
pkg-def-extras = [(hackage: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we hsould add a comment why these custom packages are necessary. Eventually someone will be hopelessly lost as to what the hell is going on.
Best to link the relevant stackage issue: commercialhaskell/stackage#4466
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, commented. That issue suggests that we could fix the yaml in stackage.
One thing I'm confused about is that this is a GHC 8.4.4 LTS not 8.6.4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is indeed a curious case. Does it work without the extras argument? This change seemed to be necessary for 8.6.x only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without the extras argument, it fails with:
Configuring library for transformers-0.5.5.0..
Setup: Encountered missing dependencies:
base (>=2 && <6) && <0
For the ghc-8.4.4 which is used by the build, ghc-pkg list | grep transformers
reports 0.5.5.0, and it's the same version in lts-12.21. It looks like there is a hackage cabal revision that disqualifies this package in the cabal solver.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what a mess...
Since https://gitlab.haskell.org/ghc/ghc/issues/16199#note_174847 (and the script was added to CI) I hope that going forward 8.6+, ghc doesn't lie about the shipped packages anymore.
Yeah I had to split out the code for creating the |
5388894
to
72174cb
Compare
e84e72d
to
45b0db2
Compare
It would also be very nice to have a one-stop function to get the shell for a whole |
With the |
I mean, I'm assuming I've already generated my package set with plan2nix, I don't need the IFD necessarily. Perhaps we don't know that the package set came from a cabal.project after we've generated it? |
Maybe plan2nix should also record some information about which packages are "home" packages? |
Wouldn't that be anything that's addressed relative? |
Yes, I guess so? Although I think we also need to include |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
It looks like https://github.com/input-output-hk/haskell.nix/pull/121/files#diff-ddd10f94c4d895dfc4bc7a0f5f968f14R61 is sometimes tripped up by getting a package, where a component is expected. Trying to isolate.. |
It could be because the stub component in https://github.com/input-output-hk/haskell.nix/pull/121/files#diff-f08a0eb1bcc8b02bf00cda55ff7e231cR16 has packages in its |
The rabbit hole was quite a bit deeper -- https://github.com/input-output-hk/haskell.nix/tree/shell-for-plus is the running result of the investigation.. |
Ok, got it working: IntersectMBO/ouroboros-network#528 |
One problem is that non-library dependencies are not quite handled as well, and they need some type-specific love. Like executables can now be added into the shell by listing them as follows: Tests and benchmarks likely need different treatment, due to dependencies they incur. |
, preHaddock | ||
, postHaddock | ||
|
||
, shellHook |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleting shellHook from the comp-builder.nix input will break my (already merged) changes for configurable shellHooks per-package: #117
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code has been moved not deleted. You should find shellHook in hspkg-builder.nix
.
To allow stack to pick git for user environnement. (waiting for input-output-hk/haskell.nix#121 for a better fix.
* Update build to use nix-tools. * updated commands for 'cardano-shell' Signed-off-by: Alexander Diemand <[email protected]> * Regeneate nix. * set project name in nix commands Signed-off-by: Alexander Diemand <[email protected]> * Fix nix-shells. * Update iohk-nix * Clean-up unused nix files. * Bump process and transformers for compat with ghc 8.6 * regenerated nix files; updated iohk-nix Signed-off-by: Alexander Diemand <[email protected]> * pinned logging to new version Signed-off-by: Alexander Diemand <[email protected]> * Update pkgs.nix * Update pkgs.nix * Update pkgs.nix * allow: cabal new-build Signed-off-by: Alexander Diemand <[email protected]> * Update pkgs.nix * bump iohk-nix (and thus haskell.nix) * regenerate * Fix katip on Windows * Set `doExactConfig` on `turtle` on windows as well. * trying cross-compilation Signed-off-by: Alexander Diemand <[email protected]> * rebased; stack2nix applied Signed-off-by: Alexander Diemand <[email protected]> * adapted; but still does not build with 'stack build --nix' Signed-off-by: Alexander Diemand <[email protected]> * Update iohk-nix. Fix nix-shells. * Disable nix-shell purity in stack.yaml To allow stack to pick git for user environnement. (waiting for input-output-hk/haskell.nix#121 for a better fix.
c94ff16
to
e8d4859
Compare
This PR is ready for review. It also works for cardano-wallet, which is a multi-package Three things not done yet (the next PRs):
|
LGTM. @deepfire do you want to take a look at this as well? |
@deepfire I needed to remove the commits from #130 because they made the tests fail. I did fix it so that |
I needed to rearrange a few things to write this function.
Now the shell provides the dependencies of the given Haskell packages, and not the packages themselves. System libraries and Haskell executables are added to the shell.
To allow stack to pick git for user environnement. (waiting for input-output-hk/haskell.nix#121 for a better fix.
Adds a
shellFor
function like in the nixpkgs haskell infra. It lets you work on multi-package projectsRelates to #108.