Skip to content

Commit 6c7f9d0

Browse files
authored
Use cabal 3.8 (#1641)
A bug was fixed in cabal 3.8 (haskell/cabal#6771) that haskell.nix relied on for `pkg-config` in support. To work around this we added a dummy `pkg-config` that `cabal configure` now uses when haskell.nix runs it `cabal configure` internally. That returns version information for all the `pkg-config` packages in `lib/pkgconfig-nixpkgs-map.nix`. This mapping has also been expanded based on the results of searching nixpkgs for `*.pc` files. This update also includes workarounds for: haskell/cabal#8352 haskell/cabal#8370 haskell/cabal#8455
1 parent d68d847 commit 6c7f9d0

File tree

173 files changed

+22911
-8463
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+22911
-8463
lines changed

builder/comp-builder.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ let
239239
(lib.concatMap (c: if c.isHaskell or false
240240
then builtins.attrValues (c.components.exes or {})
241241
else [c]) build-tools) ++
242-
lib.optional (pkgconfig != []) buildPackages.pkgconfig;
242+
lib.optional (pkgconfig != []) buildPackages.cabalPkgConfigWrapper;
243243

244244
# Unfortunately, we need to wrap ghc commands for cabal builds to
245245
# work in the nix-shell. See ../doc/removing-with-package-wrapper.md.
@@ -370,7 +370,7 @@ let
370370
frameworks # Frameworks will be needed at link time
371371
# Not sure why pkgconfig needs to be propagatedBuildInputs but
372372
# for gi-gtk-hs it seems to help.
373-
++ builtins.concatLists pkgconfig
373+
++ map pkgs.lib.getDev (builtins.concatLists pkgconfig)
374374
++ lib.optionals (stdenv.hostPlatform.isWindows)
375375
(lib.flatten component.libs
376376
++ map haskellLib.dependToLib component.depends);

builder/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let
1717
# in the native case, it would be the same in the cross case however
1818
# we *really* want to build the Setup.hs on the build machine and not
1919
# have the stdenv confuse it with the target/host env.
20-
inherit (buildPackages) stdenv pkgconfig;
20+
inherit (buildPackages) stdenv;
2121
inherit buildPackages;
2222
inherit haskellLib nonReinstallablePkgs makeSetupConfigFiles;
2323
};

builder/hspkg-builder.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ let
5353
||
5454
# These are the dependencies of `Cabal`
5555
!builtins.elem package.identifier.name
56-
["nix-tools" "alex" "happy" "hscolour" "Cabal" "bytestring" "aeson" "time"
56+
["nix-tools" "alex" "happy" "hscolour" "Cabal" "Cabal-syntax" "bytestring" "aeson" "time"
5757
"filepath" "base-compat-batteries" "base-compat" "unix" "directory" "transformers"
5858
"containers" "binary" "mtl" "text" "process" "parsec"];
5959

builder/setup-builder.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ pkgs, stdenv, lib, buildPackages, haskellLib, ghc, nonReinstallablePkgs, hsPkgs, makeSetupConfigFiles, pkgconfig }@defaults:
1+
{ pkgs, stdenv, lib, buildPackages, haskellLib, ghc, nonReinstallablePkgs, hsPkgs, makeSetupConfigFiles }@defaults:
22

33
let self =
44
{ component, package, name, src, enableDWARF ? false, flags ? {}, revision ? null, patches ? [], defaultSetupSrc
@@ -38,7 +38,7 @@ let
3838
(lib.concatMap (c: if c.isHaskell or false
3939
then builtins.attrValues (c.components.exes or {})
4040
else [c]) component.build-tools) ++
41-
lib.optional (component.pkgconfig != []) pkgconfig;
41+
lib.optional (component.pkgconfig != []) buildPackages.cabalPkgConfigWrapper;
4242

4343
drv =
4444
stdenv.mkDerivation ({

lib/call-cabal-project-to-nix.nix

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ let
167167

168168
index-state-pinned = index-state != null || cabalProjectIndexState != null;
169169

170+
pkgconfPkgs = import ./pkgconf-nixpkgs-map.nix pkgs;
171+
170172
in
171173
assert (if index-state-found == null
172174
then throw "No index state passed and none found in ${cabalProjectFileName}" else true);
@@ -329,14 +331,14 @@ let
329331
# when `checkMaterialization` is set.
330332
dummy-ghc-data =
331333
let
332-
materialized = ../materialized/dummy-ghc + "/${ghc.targetPrefix}${ghc.name}-${pkgs.stdenv.buildPlatform.system}";
334+
materialized = ../materialized/dummy-ghc + "/${ghc.targetPrefix}${ghc.name}-${pkgs.stdenv.buildPlatform.system}"
335+
+ pkgs.lib.optionalString (builtins.compareVersions ghc.version "8.10" < 0 && ghc.targetPrefix == "" && builtins.compareVersions pkgs.lib.version "22.05" < 0) "-old";
333336
in pkgs.haskell-nix.materialize ({
334337
sha256 = null;
335338
sha256Arg = "sha256";
336339
materialized = if __pathExists materialized
337340
then materialized
338-
else __trace ("WARNING: No materialized dummy-ghc-data for "
339-
+ "${ghc.targetPrefix}${ghc.name}-${pkgs.stdenv.buildPlatform.system}.")
341+
else __trace "WARNING: No materialized dummy-ghc-data. mkdir ${toString materialized}"
340342
null;
341343
reasonNotSafe = null;
342344
} // pkgs.lib.optionalAttrs (checkMaterialization != null) {
@@ -463,7 +465,7 @@ let
463465
} // pkgs.lib.optionalAttrs (checkMaterialization != null) {
464466
inherit checkMaterialization;
465467
}) (evalPackages.runCommand (nameAndSuffix "plan-to-nix-pkgs") {
466-
nativeBuildInputs = [ nix-tools dummy-ghc dummy-ghc-pkg cabal-install evalPackages.rsync evalPackages.gitMinimal ];
468+
nativeBuildInputs = [ nix-tools dummy-ghc dummy-ghc-pkg cabal-install evalPackages.rsync evalPackages.gitMinimal evalPackages.allPkgConfigWrapper ];
467469
# Needed or stack-to-nix will die on unicode inputs
468470
LOCALE_ARCHIVE = pkgs.lib.optionalString (evalPackages.stdenv.buildPlatform.libc == "glibc") "${evalPackages.glibcLocales}/lib/locale/locale-archive";
469471
LANG = "en_US.UTF-8";

lib/ghcjs-project.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
if (builtins.compareVersions ghcjsVersion "8.10.0.0" >= 0)
4040
then pkgs.haskell-nix.tool compiler-nix-name "cabal" {
4141
index-state = pkgs.haskell-nix.internalHackageIndexState;
42-
version = "3.6.2.0";
42+
version = "3.8.1.0";
4343
materialized = ../materialized/ghcjs/cabal + "/${compiler-nix-name}";
4444
}
4545
else pkgs.haskell-nix.tool compiler-nix-name "cabal" {
@@ -48,7 +48,7 @@
4848
# Cabal 3.2.1.0 no longer supports he mix of `cabal-version`,
4949
# lack of `custom-setup` and `v1-install` used by ghcjs boot.
5050
cabalProjectLocal = ''
51-
constraints: Cabal <3.2.1.0
51+
constraints: Cabal <3.2.1.0, Cabal-syntax <0
5252
'';
5353
materialized = ../materialized/ghcjs/cabal + "/${compiler-nix-name}";
5454
}

0 commit comments

Comments
 (0)