Skip to content

Commit 1662092

Browse files
authored
Fix for tests broken by cabal update in hackage (#1585)
1 parent 61791eb commit 1662092

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

builder/make-config-files.nix

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ let
1111

1212
flagsAndConfig = field: xs: lib.optionalString (xs != []) ''
1313
echo ${lib.concatStringsSep " " (map (x: "--${field}=${x}") xs)} >> $out/configure-flags
14-
echo "${field}: ${lib.concatStringsSep " " xs}" >> $out/cabal.config
14+
${lib.concatStrings (map (x: ''
15+
echo "${field}: ${x}" >> $out/cabal.config
16+
'') xs)}
1517
'';
1618

1719
target-pkg = "${ghc.targetPrefix}ghc-pkg";
@@ -127,8 +129,11 @@ let
127129
done
128130
129131
${ # Note: we pass `clear` first to ensure that we never consult the implicit global package db.
130-
flagsAndConfig "package-db" ["clear" "$out/${packageCfgDir}"]
132+
# However in `cabal.config` `cabal` requires `global` to be first.
133+
flagsAndConfig "package-db" ["clear"]
131134
}
135+
echo "package-db: global" >> $out/cabal.config
136+
${ flagsAndConfig "package-db" ["$out/${packageCfgDir}"] }
132137
133138
echo ${lib.concatStringsSep " " (lib.mapAttrsToList (fname: val: "--flags=${lib.optionalString (!val) "-" + fname}") flags)} >> $out/configure-flags
134139

test/cabal-simple/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ in recurseIntoAttrs {
3030
};
3131

3232
# Used for testing externally with nix-shell (../tests.sh).
33-
test-shell = project.shellFor { tools = { cabal = "3.6.2.0"; }; withHoogle = !__elem compiler-nix-name ["ghc901" "ghc902" "ghc921" "ghc922" "ghc923" "ghc924"]; };
33+
test-shell = project.shellFor { tools = { cabal = "latest"; }; withHoogle = !__elem compiler-nix-name ["ghc901" "ghc902" "ghc921" "ghc922" "ghc923" "ghc924"]; };
3434

3535
run = stdenv.mkDerivation {
3636
name = "cabal-simple-test";

test/shell-for/default.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ let
2323
packages = ps: with ps; [ pkga pkgb ];
2424
# This adds cabal-install to the shell, which helps tests because
2525
# they use a nix-shell --pure. Normally you would BYO cabal-install.
26-
tools = { cabal = "3.2.0.0"; };
26+
tools = { cabal = "latest"; };
2727
exactDeps = true;
2828
# Avoid duplicate package issues when runghc looks for packages
2929
packageSetupDeps = false;
@@ -34,7 +34,7 @@ let
3434
packages = ps: with ps; [ pkga ];
3535
# This adds cabal-install to the shell, which helps tests because
3636
# they use a nix-shell --pure. Normally you would BYO cabal-install.
37-
tools = { cabal = "3.2.0.0"; };
37+
tools = { cabal = "latest"; };
3838
exactDeps = true;
3939
# Avoid duplicate package issues when runghc looks for packages
4040
packageSetupDeps = false;
@@ -46,7 +46,7 @@ let
4646
# packages = ps: with ps; [ pkga pkgb ];
4747
# This adds cabal-install to the shell, which helps tests because
4848
# they use a nix-shell --pure. Normally you would BYO cabal-install.
49-
tools = { cabal = "3.2.0.0"; };
49+
tools = { cabal = "latest"; };
5050
# Avoid duplicate package issues when runghc looks for packages
5151
packageSetupDeps = false;
5252
};

0 commit comments

Comments
 (0)