Skip to content
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

Use cabal 3.8 #1641

Merged
merged 17 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions builder/comp-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ let
(lib.concatMap (c: if c.isHaskell or false
then builtins.attrValues (c.components.exes or {})
else [c]) build-tools) ++
lib.optional (pkgconfig != []) buildPackages.pkgconfig;
lib.optional (pkgconfig != []) buildPackages.cabalPkgConfigWrapper;

# Unfortunately, we need to wrap ghc commands for cabal builds to
# work in the nix-shell. See ../doc/removing-with-package-wrapper.md.
Expand Down Expand Up @@ -370,7 +370,7 @@ let
frameworks # Frameworks will be needed at link time
# Not sure why pkgconfig needs to be propagatedBuildInputs but
# for gi-gtk-hs it seems to help.
++ builtins.concatLists pkgconfig
++ map pkgs.lib.getDev (builtins.concatLists pkgconfig)
++ lib.optionals (stdenv.hostPlatform.isWindows)
(lib.flatten component.libs
++ map haskellLib.dependToLib component.depends);
Expand Down
2 changes: 1 addition & 1 deletion builder/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let
# in the native case, it would be the same in the cross case however
# we *really* want to build the Setup.hs on the build machine and not
# have the stdenv confuse it with the target/host env.
inherit (buildPackages) stdenv pkgconfig;
inherit (buildPackages) stdenv;
inherit buildPackages;
inherit haskellLib nonReinstallablePkgs makeSetupConfigFiles;
};
Expand Down
2 changes: 1 addition & 1 deletion builder/hspkg-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ let
||
# These are the dependencies of `Cabal`
!builtins.elem package.identifier.name
["nix-tools" "alex" "happy" "hscolour" "Cabal" "bytestring" "aeson" "time"
["nix-tools" "alex" "happy" "hscolour" "Cabal" "Cabal-syntax" "bytestring" "aeson" "time"
"filepath" "base-compat-batteries" "base-compat" "unix" "directory" "transformers"
"containers" "binary" "mtl" "text" "process" "parsec"];

Expand Down
4 changes: 2 additions & 2 deletions builder/setup-builder.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, stdenv, lib, buildPackages, haskellLib, ghc, nonReinstallablePkgs, hsPkgs, makeSetupConfigFiles, pkgconfig }@defaults:
{ pkgs, stdenv, lib, buildPackages, haskellLib, ghc, nonReinstallablePkgs, hsPkgs, makeSetupConfigFiles }@defaults:

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

drv =
stdenv.mkDerivation ({
Expand Down
10 changes: 6 additions & 4 deletions lib/call-cabal-project-to-nix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ let

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

pkgconfPkgs = import ./pkgconf-nixpkgs-map.nix pkgs;

in
assert (if index-state-found == null
then throw "No index state passed and none found in ${cabalProjectFileName}" else true);
Expand Down Expand Up @@ -329,14 +331,14 @@ let
# when `checkMaterialization` is set.
dummy-ghc-data =
let
materialized = ../materialized/dummy-ghc + "/${ghc.targetPrefix}${ghc.name}-${pkgs.stdenv.buildPlatform.system}";
materialized = ../materialized/dummy-ghc + "/${ghc.targetPrefix}${ghc.name}-${pkgs.stdenv.buildPlatform.system}"
+ pkgs.lib.optionalString (builtins.compareVersions ghc.version "8.10" < 0 && ghc.targetPrefix == "" && builtins.compareVersions pkgs.lib.version "22.05" < 0) "-old";
in pkgs.haskell-nix.materialize ({
sha256 = null;
sha256Arg = "sha256";
materialized = if __pathExists materialized
then materialized
else __trace ("WARNING: No materialized dummy-ghc-data for "
+ "${ghc.targetPrefix}${ghc.name}-${pkgs.stdenv.buildPlatform.system}.")
else __trace "WARNING: No materialized dummy-ghc-data. mkdir ${toString materialized}"
null;
reasonNotSafe = null;
} // pkgs.lib.optionalAttrs (checkMaterialization != null) {
Expand Down Expand Up @@ -463,7 +465,7 @@ let
} // pkgs.lib.optionalAttrs (checkMaterialization != null) {
inherit checkMaterialization;
}) (evalPackages.runCommand (nameAndSuffix "plan-to-nix-pkgs") {
nativeBuildInputs = [ nix-tools dummy-ghc dummy-ghc-pkg cabal-install evalPackages.rsync evalPackages.gitMinimal ];
nativeBuildInputs = [ nix-tools dummy-ghc dummy-ghc-pkg cabal-install evalPackages.rsync evalPackages.gitMinimal evalPackages.allPkgConfigWrapper ];
# Needed or stack-to-nix will die on unicode inputs
LOCALE_ARCHIVE = pkgs.lib.optionalString (evalPackages.stdenv.buildPlatform.libc == "glibc") "${evalPackages.glibcLocales}/lib/locale/locale-archive";
LANG = "en_US.UTF-8";
Expand Down
4 changes: 2 additions & 2 deletions lib/ghcjs-project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
if (builtins.compareVersions ghcjsVersion "8.10.0.0" >= 0)
then pkgs.haskell-nix.tool compiler-nix-name "cabal" {
index-state = pkgs.haskell-nix.internalHackageIndexState;
version = "3.6.2.0";
version = "3.8.1.0";
materialized = ../materialized/ghcjs/cabal + "/${compiler-nix-name}";
}
else pkgs.haskell-nix.tool compiler-nix-name "cabal" {
Expand All @@ -48,7 +48,7 @@
# Cabal 3.2.1.0 no longer supports he mix of `cabal-version`,
# lack of `custom-setup` and `v1-install` used by ghcjs boot.
cabalProjectLocal = ''
constraints: Cabal <3.2.1.0
constraints: Cabal <3.2.1.0, Cabal-syntax <0
'';
materialized = ../materialized/ghcjs/cabal + "/${compiler-nix-name}";
}
Expand Down
Loading