Skip to content

Commit 858b81b

Browse files
committed
Fix test running for natnormalise and extra plugins
1 parent 32b4294 commit 858b81b

File tree

2 files changed

+33
-10
lines changed

2 files changed

+33
-10
lines changed

flake.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nix/overlay.nix

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@ let
2121
pkgs = prev;
2222
};
2323

24+
# Some type checker plugins have tests that invoke GHC which requires the package
25+
# themselves to be available.
26+
ghc-typelits-plugins-preCheck-script = pkgName: ''
27+
unset GHC_ENVIRONMENT
28+
wrapper="''${TMPDIR:-/tmp}/ghc-for-tests"
29+
cat > "$wrapper" <<'EOF'
30+
#!/bin/sh
31+
exec ghc -package-db "$PWD/dist/package.conf.inplace" -package ${pkgName} "$@"
32+
EOF
33+
chmod +x "$wrapper"
34+
export HC="$wrapper"
35+
'';
36+
2437
# An overlay with the packages we pull in as inputs to this flake.
2538
#
2639
# This is mostly intended for packages developed by QBayLogic which are
@@ -34,10 +47,15 @@ let
3447
{ };
3548

3649
ghc-typelits-extra =
37-
hprev.callCabal2nix
38-
"ghc-typelits-extra"
39-
"${ghc-typelits-extra}"
40-
{ };
50+
prev.haskell.lib.overrideCabal
51+
(hprev.callCabal2nix
52+
"ghc-typelits-extra"
53+
"${ghc-typelits-extra}"
54+
{ }
55+
)
56+
(drv: {
57+
preCheck = ghc-typelits-plugins-preCheck-script "ghc-typelits-extra";
58+
});
4159

4260
ghc-typelits-knownnat =
4361
hprev.callCabal2nix
@@ -46,10 +64,15 @@ let
4664
{ };
4765

4866
ghc-typelits-natnormalise =
49-
hprev.callCabal2nix
50-
"ghc-typelits-natnormalise"
51-
"${ghc-typelits-natnormalise}"
52-
{ };
67+
prev.haskell.lib.overrideCabal
68+
(hprev.callCabal2nix
69+
"ghc-typelits-natnormalise"
70+
"${ghc-typelits-natnormalise}"
71+
{ }
72+
)
73+
(drv: {
74+
preCheck = ghc-typelits-plugins-preCheck-script "ghc-typelits-natnormalise";
75+
});
5376
};
5477

5578
# An overlay with the packages in this repository.

0 commit comments

Comments
 (0)