-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
haskell: set buildInputs in nix-shell env #32821
Conversation
systemBuildInputs goes in buildInputs (instead of nativeBuildInputs) so that NIX_CFLAGS_* is set correctly and gcc works.
This has come up before. Personally, I don't want system libraries to be found automatically. I want the necessary search paths to be configured with Cabal so that these paths are recorded in the generated package config files. This is necessary for packages compiled inside of a |
See also #28033 for previous discussions. |
Do you think your concerns in #28033 are still relevant now that both |
In any case, |
Didn’t know about that, sounds like a horrible solution. Suddenly every build tool knows about every other build tool 😟.
Since there’s now multiple people who independently requested picking up the shell environment, maybe it’s time to find a compromise that works for both use cases? |
I think we've been back and forth about this before. I see what you're saying, but let me counter: Nix is set up like a build server; cabal is just using it like one! It's better than this situation:
This only works because of a bug in cabal that the package config cache is not invalidated when the environment changes. And when the cache is finally invalidated, it breaks the cache regeneration. Finally, when cabal projects are enabled by default, it probably won't work at all because the cache invalidation bug will be fixed.
Overlays? |
You are right, that is a good point. Let's fix that issue now and worry about whether to remove them entirely or not in a separate PR. |
I'll fix this. The solution is a wrapped cabal install and a setup hook such that.
Then we properly specify all the deps exactly the same way in generic build and shell environments. In fact, we can use the setup hook with generic builder too. |
If anyone can review #33358 in the meantime, that would be nice. It will be easier to get the dependency types correct with that in place. |
WIP #33368 |
Motivation
nix-shell
for Haskell projects with foreign library dependencies is broken because GCC cannot find headers or libraries.systemBuildInputs goes in buildInputs (instead of nativeBuildInputs) so that
NIX_CFLAGS_* is set correctly and gcc works.
Testing
build-use-sandbox
innix.conf
on non-NixOS)Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)Tested compilation of all pkgs that depend on this change usingnix-shell -p nox --run "nox-review wip"
./result/bin/
)Because Haskell packages use a separate shell environment not derived from the build environment, this should not affect the build of anything in Nixpkgs.