haskell-nix icon indicating copy to clipboard operation
haskell-nix copied to clipboard

Changing the compiler doesn't work well with callCabal2nix

Open langston-barrett opened this issue 6 years ago • 2 comments

When using the suggested format

      haskell = pkgs.haskell // {
        packages = pkgs.haskell.packages // {
          "${compiler}" = pkgs.haskell.packages."${compiler}".override {
            overrides = galoisOverrides;
          };
        };
      };

to override the GHC version, the pkgs.haskellPackages attribute is not overriden, so e.g. callCabal2nix doesn't use the selected version. Additionally, one must select the package from the new compiler's package set:

project1 = pkgs.haskell.packages.${compiler}.project1;

Why not use the following instead?

      haskellPackages = pkgs.haskell.packages."${compiler}".override {
        overrides = [...];
      };

This provides a more consistent interface for the rest of your Nix files.

langston-barrett avatar Aug 14 '18 18:08 langston-barrett

@siddharthist: How are you invoking callCabal2nix? The reason I ask is that pkgs.haskell.packages.${compiler}.callCabal2nix should work or haskellPackagesNew.callCabal2nix should work inside an override block

However, I still agree that it would probably be simpler to override haskellPackages so I'll still make that change

Gabriella439 avatar Aug 16 '18 14:08 Gabriella439

@Gabriel439 I was using it in such a way that I was getting haskellPackages.callCabal2nix instead of haskell.packages.${compiler}, which makes more sense... Thanks!

langston-barrett avatar Aug 16 '18 16:08 langston-barrett