I have a problem which boils down to this simplified example. Say I have the following shell.nix file:
let
base = import <nixpkgs> {};
pinnedVersion = base.pkgs.lib.importJSON ./nixpkgs.json;
nixpkgs = base.pkgs.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
inherit (pinnedVersion) rev sha256;
};
pkgs = import nixpkgs { };
p = ({ mkDerivation, base }:
mkDerivation {
pname = "foo";
version = "0.0.0.1";
src = ./.;
isLibrary = true;
license = "GPL";
isExecutable = true;
libraryHaskellDepends = [ base ];
libraryToolDepends = [ ];
executableHaskellDepends = [ base ];
testHaskellDepends = [ base ];
});
in
pkgs.haskellPackages.callPackage p {}
this is just a dummy derivation. I fire off 'nix-shell' and inside the shell:
$ ghc-pkg list /nix/store/f520j7wfgp9h2mmq6rk36r6vgsb279sf-ghc-8.8.3/lib/ghc-8.8.3/package.conf.d Cabal-3.0.1.0 ...
So version 3.0.1.0 of the Cabal library is in the ghc package set.. ok but the thing is, the version of Nixpkgs I am using above (i.e. the one pinned in the following JSON) ...
{
"url": "https://github.com/nixos/nixpkgs.git",
"rev": "6cf0ed0c04fb3aa7f81b46d0c90bae6457964b3f",
"date": "2020-07-02T07:24:47+02:00",
"path": "/nix/store/gkilcm4l6qsp31lapirjxd1mn1dnn100-nixpkgs",
"sha256": "0sp8108j70f3kz3r8hagiyq21sjwr46n0dqg16gb27k7761bcvpg",
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false
}
... only has Cabal library versions 3.2.0.0, 2.4.1.0 and 2.2.0.1 available. See below:
$ nix repl Welcome to Nix version 2.3.1. Type :? for help. nix-repl> base = import <nixpkgs> {} nix-repl> pinnedVersion = base.pkgs.lib.importJSON ./nixpkgs.json nix-repl> nixpkgs = base.pkgs.fetchFromGitHub { owner = "NixOS"; repo = "nixpkgs"; inherit (pinnedVersion) rev sha256; } nix-repl> pkgs=import nixpkgs { } nix-repl> pkgs.haskellPackages.Cabal *<tab> <tab>* pkgs.haskellPackages.Cabal pkgs.haskellPackages.Cabal_2_4_1_0 pkgs.haskellPackages.Cabal-ide-backend pkgs.haskellPackages.Cabal_3_2_0_0 pkgs.haskellPackages.CabalSearch pkgs.haskellPackages.Cabal_2_2_0_1 nix-repl> pkgs.haskellPackages.Cabal pkgs.haskellPackages.Cabal pkgs.haskellPackages.Cabal_2_4_1_0 pkgs.haskellPackages.Cabal-ide-backend pkgs.haskellPackages.Cabal_3_2_0_0 pkgs.haskellPackages.CabalSearch pkgs.haskellPackages.Cabal_2_2_0_1 nix-repl> pkgs.haskell.packages.ghc883.Cabal *<tab> <tab>* pkgs.haskell.packages.ghc883.Cabal pkgs.haskell.packages.ghc883.Cabal-ide-backend pkgs.haskell.packages.ghc883.CabalSearch pkgs.haskell.packages.ghc883.Cabal_2_2_0_1 pkgs.haskell.packages.ghc883.Cabal_2_4_1_0 pkgs.haskell.packages.ghc883.Cabal_3_2_0_0
So this is getting pulled into my nix-shell environment "somehow" and I think I am simply hitting the limit of my understanding on how Haskell nix packages are put together and in particular the GHC package set etc. Can someone shed some light into the apparently missing gap? Thanks!
EDIT: I am not sure if the question is actually clear.. the actual question is: why is there a Cabal_3_0_1_0 library in my GHC packages when everything in this Nixpkgs version suggests it should have a Cabal_3_2_0_0 and furthermore, how can I override this? Thanks!