-
Notifications
You must be signed in to change notification settings - Fork 245
shellFor: provide build tools for all packages when exactDeps = false. Fix #1753. #1769
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
builder/shell-for.nix
Outdated
@@ -167,7 +167,9 @@ in | |||
buildInputs = systemInputs | |||
++ mkDrvArgs.buildInputs or []; | |||
nativeBuildInputs = [ ghcEnv ] | |||
++ nativeBuildInputs | |||
# We remove hsc2hs from dependencies provided by packages `build-tools` | |||
# since it is already provided by `ghcEnv` (avoid collisions). |
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 is safe because... hsc2hs comes with GHC, so we can't end up in a situation where packages depend on multiple different versions? or what?
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.
yes hsc2hs
comes with GHC, and ghcEnv
binaries are first in PATH so hsc2hs
from ghcEnv has always been the one used anyway.
Interesting. I'm kind of surprised we don't get a collision error in I'd like an opinion from @hamishmack on this one also. |
yes because |
fbfd86f
to
c699866
Compare
Ah I see. I wonder if this is something we should also check for? Presumably such cases of PATH shadowing might lead to bugs? More generally, I guess we might behave badly if we have two packages that need to be built locally which need different versions of a build tool! |
c699866
to
01f822f
Compare
I just happened to spot this in |
If this was done only for the nix-shell then yes, but probably not, need to test. |
if not then maybe instead of my patch we need to filter out |
When not using `exactDeps` cabal may try to build arbitrary dependencies so in this case we need to provide the build tools for all of hsPkgs.
since it is provided by ghc env, which is first in PATH. This avoid possible collisions when using eg. devshells, which fuse all binaries into a single output directory.
01f822f
to
9289103
Compare
I moved the filtering-out of However I doubt this ability still exists: ghc-env is always first in haskell.nix/builder/comp-builder.nix Lines 388 to 390 in 7629276
And in any case, this config flag indicates that, at least for cross-compile, only the haskell.nix/builder/comp-builder.nix Line 175 in 7629276
|
That's an interesting obersavtion. Should (explicitly specified) build-tools have precedence over the things that are shipped with GHC? That might actually be the correct thing to do. As for the cross case. Thats mostly because we want tooling consistency and GHC's build system will prefix all produced binaries with the target prefix. I believe you could even plug in another hsc2hs just fine. |
bors try |
I guess in the future we could try removing Perhaps There is a similar problem with |
tryTimed out. |
I don't quite understand the issue here, could someone make a ticket for this so we don't forget? |
bors try |
bors try |
tryAlready running a review |
tryTimed out. |
bors try |
tryTimed out. |
I added an issue for supporting |
#1769 added all the tool dependencies of the hsPkgs in a project to the shell. This is great for cabal projects where the set of packages will be limited to those in the plan. It allows these packages to be rebuilt by cabal. For stack projects however this set is much larger (all of stackage), likely to include unwanted tools and tools that may be broken. This change adds `shell.allDeps` and defaults it to `false` for stack projects. Fixes #1793
#1769 added all the tool dependencies of the hsPkgs in a project to the shell. This is great for cabal projects where the set of packages will be limited to those in the plan. It allows these packages to be rebuilt by cabal. For stack projects however this set is much larger (all of stackage), likely to include unwanted tools and tools that may be broken. This change adds `shell.allDeps` and defaults it to `false` for stack projects. Fixes #1793
* Add `shell.allDeps` as a fix for #1793 #1769 added all the tool dependencies of the hsPkgs in a project to the shell. This is great for cabal projects where the set of packages will be limited to those in the plan. It allows these packages to be rebuilt by cabal. For stack projects however this set is much larger (all of stackage), likely to include unwanted tools and tools that may be broken. This change adds `shell.allDeps` and defaults it to `false` for stack projects. Fixes #1793 * Added comments
This fix #1753.
also only depends on
hsc2hs
fromghcEnv
to avoid collisions when using devshell (haskellLib.devshellFor
).