Skip to content

Commit 0c88c57

Browse files
committed
re-enable nix ci tests
1. we don't need to import diffutils in nix, they come with stdenv 2. cabal2nix doesn't seem to pick up build-tool-depends, so we add agda2hs to $PATH manually in the nix build
1 parent 15263df commit 0c88c57

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

.github/workflows/nix-ci.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ jobs:
6161
with:
6262
primary-key: nix-devshell-${{ hashFiles('**/*.nix', '**/flake.lock') }}
6363
- name: drop into the devshell and run cabal
64-
# for some reason this doesn't work without update
65-
# even though it doesn't actually download anything
64+
# we're using v1 command due to a lonstanding cabal-nix bug
65+
#
66+
# explainer: https://gist.github.com/ScottFreeCode/ef9f254e2dd91544bba4a068852fc81f
67+
#
68+
# bugs:
69+
# https://github.com/haskell/cabal/issues/8434
70+
# https://github.com/NixOS/nixpkgs/issues/130556
71+
# https://github.com/NixOS/nixpkgs/issues/176887
72+
#
73+
# finally, v1-build doesn't work without update for some reason
74+
# even though the update doesn't actually download anything
6675
run: nix develop -Lv -c bash -c "cabal update; cabal v1-build"

nix/agda2hs.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
makeWrapper,
1313
writeText,
1414
ghcWithPackages,
15-
diffutils,
1615
}:
1716

1817
let
@@ -53,7 +52,6 @@ let
5352
{
5453
inherit pname version;
5554
nativeBuildInputs = [
56-
diffutils
5755
makeWrapper
5856
];
5957
passthru = {

nix/lib.nix

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,18 @@ let
1010
src = ../.;
1111
extraCabal2nixOptions = options; # "--jailbreak"
1212
};
13-
# Disable tests in nix build - the testsuite requires the agda2hs binary
14-
# to be in PATH, which is a circular dependency. Tests should be run
15-
# via `cabal test` in a development environment instead.
16-
hpkg = pkgs.haskell.lib.dontCheck (pkgs.haskellPackages.callPackage (hsrc "") { });
13+
hpkg = (pkgs.haskellPackages.callPackage (hsrc "") {}).overrideAttrs (
14+
finAttr: preAttr: {
15+
# make executables executable and add ./dist/build to PATH
16+
# cabal2nix doesn't pick up agda2hs from build-tool-depends of the test suite
17+
# my (@liesnikov) guess is that since the intermediate binary
18+
# is not a separate derivation it's hard to form a fixpoint on a derivation level
19+
preCheck = ''
20+
find dist/build -exec chmod u+X {} +
21+
export PATH=$(pwd)/dist/build/:$PATH
22+
'';
23+
}
24+
);
1725
expr = import ./agda2hs.nix;
1826
agda2hs = pkgs.lib.makeScope pkgs.newScope (
1927
self:

nix/shell.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,5 @@ pkgs.haskellPackages.shellFor {
2424
pkgs.nixfmt-rfc-style
2525
cabal2nix
2626
pkgs.haskellPackages.fix-whitespace
27-
# The testsuite uses diff, so ensure `diff` is available in the shell/tests
28-
pkgs.diffutils
2927
];
3028
}

0 commit comments

Comments
 (0)