-
-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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: Overriding compiler causes duplicate GHCs on PATH #101580
Comments
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/patching-ghc-for-your-project/9614/4 |
When I
I find it weird that I only get a
instead of a |
My guess is that you need to override nixpkgs/pkgs/top-level/haskell-packages.nix Lines 159 to 163 in b37c198
I arrived at this guess by looking at the .drv file for I don't know how things like The following derivation only references one GHC: let
myOverlay = final: prev: {
haskell = prev.haskell // {
packages = prev.haskell.packages // {
ghc865 = prev.haskell.packages.ghc865.override {
ghc = prev.haskell.compiler.ghc865.overrideAttrs (old: {
x = 1;
});
};
};
};
};
# This is a checkout of nixpkgs at commit 598ffa1176.
pkgs = import ~/git/nixpkgs {
overlays = [ myOverlay ];
};
in
pkgs.haskell.packages.ghc865.Diff |
I marked this as stale due to inactivity. → More info |
If you use
haskell.packages.ghc*.override { ghc = ... }
then contrary to expectations, not only the overridden GHC will be on PATH for the build, but the un-overriden one as well, which can cause the wrong one to be picked sometimes.See https://discourse.nixos.org/t/patching-ghc-for-your-project/9614/3?u=nh2
Steps to reproduce
Clone nixpkgs, inside create a file
duplicate-ghcs.nix
with contents:Run
nix-store -qR $(NIX_PATH=nixpkgs=. nix-instantiate duplicate-ghcs.nix) | grep ghc-8.6.5
, you'll see 1 GHC in use (good):Then comment in the override:
Now
nix-store -qR $(NIX_PATH=nixpkgs=. nix-instantiate duplicate-ghcs.nix) | grep ghc-8.6.5
, shows 2 GHCs in use (bad):Tested on 20.03 and current nixpkgs
master
commit 579daed.CC @peti
The text was updated successfully, but these errors were encountered: