-
Notifications
You must be signed in to change notification settings - Fork 240
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
build-tool-depends executables don't appear in shellFor #839
Comments
Ah, thanks! |
I think I know how to fix this now, thanks @ocharles. |
@rvl Oh, fantastic! Do you need any help with anything? Happy to test anything, if that helps! |
A similar issue seems to happen if your shell dependencies have build tool dependencies. E.g.,
Not sure if the same thing happens on stack projects, but I would presume not considering that |
I spent a little bit of time looking at this. Firstly, I noticed that we don't pass But then it still doesn't appear in the package db. It turns out that |
Yeah I don't think they should be registered in the same package db, especially if package DBs are to be per machine for cross. When you need a library, you usually need lots of information beyond the machine code (unfoldings for inlining, etc.) but for an executable dependency, one just needs to be able to run the thing, and being agnostic to how the sausage is made is probably better for sake of determinism / caching. |
Well, not having it in the package db confuses cabal, so I don't see how we can avoid it (if we want this usecase to work!). As far as cross goes, obviously the build-tools should be in the native package db in the glorious future once we've got a separate native package db. Then I think there's no real problem with them being there. |
Note that this really isn't specific shellFor, but specific to v2 cabal. You can always use The reason this is really difficult is that both Nixpkgs & haskell.nix use the Setup.hs method of configure / install, which doesn't install a .conf file for executable components. I'm not sure if it makes more sense to patch Cabal so Setup.hs method installs executables correctly, or try to switch to the new install method. See Cabal comment for reference:
|
Thanks for digging into that! |
v2 cabal-install recently got a --package-db flag that an be used to specify additional package dbs, though I'm not sure if it can actually help with this issue. Here's the pr for refernece: haskell/cabal#7676 |
For the record, this is also an issue for |
The latest state of this issue seems to be: #1367 (comment) |
No, I think that's unrelated. This isn't anything to do with |
It seems like this is a duplicate of #231? |
This one is more general, yes the other is a dupe. |
Is there any work that can be done to help solve this problem? We're trying to migrate to |
I haven't been able to look into this yet, but I really hope you are able to push this front forward. My primary selling point for haskell.nix has been "You can avoid knowing nix and just update your cabal.project/package.cabal file but get cross compilation, reproducibility, docker containers, etc". @parsonsmatt I see in your linked issue your team is wanting the same: Use Partial cabal.project support breaks this sellling point. I hope to deep dive into this issue and figure out haskell.nix well enough to solve some of these problems myself in the future, but I have other high priority things blocking it sadly 😢 |
Note that the new `haskell.nix` pin necessitates the following additional changes: * We switch temporarily to our own `haskell.nix` fork, as recent versions no longer work with `nixpkgs`'s NixOS test framework. See input-output-hk/haskell.nix#1859. * We include a workaround for input-output-hk/haskell.nix#1857 (which itself is a workaround for input-output-hk/haskell.nix#839). * We no longer need the `hostPkgs` hack to make the NixOS tests build. * We need to bump the NixOS VM disk size, as it's no longer large enough to build the `primer-service` Docker image.
After commenting on the linked cabal issue, I came here to say this is a short-coming of shellFor and should be fixed in haskell.nix, but then I noticed I do get
Did the issue solve itself? Or maybe the issue is that, inside the shell, cabal will recompile tasty-discover anyway? (which is related to #1662). |
I don't think we're all the way there. I too am seeing |
@JackKelly-Bellroy thanks for double checking! Yes, unfortunately I would expect cabal to rebuild it (issue I have been discussing in the cabal repo). At least they should be exactly the same version; if not, it's a bug in haskell.nix we need to fix. |
FWIW this is an underlying nix-shell + cabal v2 problem and not just a haskell.nix thing – it's also possible in general to use cabal as the source of truth with nix's I have a straightforward reproduction without iohk's/iog's haskell.nix, here: https://gist.github.com/ScottFreeCode/c1adb5681c5b61c61373615f63a4a7d2 I've collected GitHub issues relating to this problem here: https://gist.github.com/ScottFreeCode/ef9f254e2dd91544bba4a068852fc81f @andreabedini Here's another one you checked in on recently that appears to be this same issue. |
I'm observing different behavior from that described here.
Haven't been able to come up with a workaround so far. EDIT: Workaround proferred by sclv is to provide |
I want to use
tasty-discover
, which I have added to my.cabal
file as:As described in input-output-hk/nix-tools#95, this adds a
build-tools
entry in thecabal-to-nix
expression, which is used insetup-builder.nix
to formexecutableToolDepends
. However, it doesn't propagate correctly into the shell produced withshellFor
. Forbuild-tool-depends
to work, we need atasty-discover
entry in theghc-pkg
database that also has thetasty-discover
executable. As things currently stand, there is no entry at all. We can useadditional = pkgs: [ pkgs.tasty-discover ]
, but that will only add atasty-discover
to the package database as a library - no executables will get included.The text was updated successfully, but these errors were encountered: