1- name : Haskell CI with Nix
1+ name : Nix CI
22
33on :
44 push :
@@ -10,8 +10,6 @@ permissions:
1010jobs :
1111 nix-ci :
1212 runs-on : ubuntu-latest
13- env :
14- NIX_CONFIG : accept-flake-config = true
1513
1614 steps :
1715 - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -25,34 +23,50 @@ jobs:
2523 - name : Enable Nix cache
2624 uses : DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13
2725
28- - name : Show toolchain versions from nix shell
29- shell : bash
26+ - name : Debug library environment
3027 run : |
31- nix develop --command bash -lc 'ghc --numeric-version'
32- nix develop --command bash -lc 'cabal --numeric-version'
33- nix develop --command bash -lc 'stack --numeric-version || true'
34- nix develop --command bash -lc 'fourmolu --version'
35-
36- - name : Check formatting
37- run : nix develop --command make format-check
38-
39- - name : Check cabal file
40- run : nix develop --command make cabal-check
41-
42- - name : Update cabal package index
43- run : nix develop --command make cabal-update
44-
45- - name : Configure the build
46- run : nix develop --command make configure
47-
48- - name : Build dependencies
49- run : nix develop --command make deps
50-
51- - name : Build the package
52- run : nix develop --command make build
53-
54- - name : Run tests
55- run : nix develop --command make test
56-
57- - name : Build documentation
58- run : nix develop --command make docs
28+ nix develop --command bash -c '
29+ echo "=== LD_LIBRARY_PATH ==="
30+ echo "$LD_LIBRARY_PATH" | tr ":" "\n"
31+ echo ""
32+ echo "=== Files in each LD_LIBRARY_PATH dir ==="
33+ echo "$LD_LIBRARY_PATH" | tr ":" "\n" | while read dir; do
34+ echo "--- $dir ---"
35+ ls "$dir"/*.so* 2>/dev/null || echo "(no .so files)"
36+ done
37+ echo ""
38+ echo "=== GHC CC from settings ==="
39+ ghc_libdir=$(ghc --print-libdir)
40+ python3 -c "
41+ data = open(\"$ghc_libdir/settings\").read()
42+ for line in eval(data):
43+ if \"compiler\" in line[0].lower() or \"ld\" in line[0].lower() or \"linker\" in line[0].lower():
44+ print(f\"{line[0]}: {line[1]}\")
45+ "
46+ echo ""
47+ echo "=== CC wrapper nix-support ==="
48+ ghc_cc=$(python3 -c "data=open(\"$ghc_libdir/settings\").read(); print(dict(eval(data))[\"C compiler command\"])")
49+ echo "CC: $ghc_cc"
50+ wrapper_dir=$(dirname "$ghc_cc")/../nix-support
51+ echo "=== libc-ldflags ==="
52+ cat "$wrapper_dir/libc-ldflags" 2>/dev/null || echo "(not found)"
53+ echo "=== dynamic-linker ==="
54+ cat "$wrapper_dir/dynamic-linker" 2>/dev/null || echo "(not found)"
55+ echo "=== cc-ldflags ==="
56+ cat "$wrapper_dir/cc-ldflags" 2>/dev/null || echo "(not found)"
57+ echo "=== NIX_LDFLAGS from env ==="
58+ echo "$NIX_LDFLAGS"
59+ echo ""
60+ echo "=== Test: compile and run minimal C program ==="
61+ cat > /tmp/test.c << CEOF
62+ #include <stdio.h>
63+ int main() { printf("hello from test binary\n"); return 0; }
64+ CEOF
65+ $ghc_cc -o /tmp/test_bin /tmp/test.c && ldd /tmp/test_bin && /tmp/test_bin
66+ echo ""
67+ echo "=== Test: compile with -lbz2 ==="
68+ $ghc_cc -o /tmp/test_bz2 /tmp/test.c -lbz2 2>&1 && ldd /tmp/test_bz2 && /tmp/test_bz2
69+ '
70+
71+ - name : Build and test
72+ run : nix develop --command make ci
0 commit comments