diff --git a/.ci/build.sh b/.ci/build.sh index 1d42013b0e..240717d79e 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -34,16 +34,15 @@ clash-prelude:doctests clash-prelude:unittests clash-testsuite:clash-testsuite " -mkdir bin -for TEST in $TESTS; do - ln -s "$(realpath --relative-to=bin "$(cabal list-bin $TEST)")" bin/$TEST -done -# TODO: remove this and put it back into tests when -# https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406 -# is fixed +# GHC 9.8.3, 9.8.4 and 9.10.2 have issues, see https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406 set +u if [[ "$SKIP_CLASH_FFI_EXAMPLE" != "yes" ]]; then - ln -s "$(realpath --relative-to=bin "$(cabal list-bin clash-ffi:ffi-interface-tests)")" bin/clash-ffi:ffi-interface-tests + TESTS="$TESTS clash-ffi:ffi-interface-tests" fi set -u + +mkdir bin +for TEST in $TESTS; do + ln -s "$(realpath --relative-to=bin "$(cabal list-bin $TEST)")" bin/$TEST +done diff --git a/.ci/docker/Dockerfile b/.ci/docker/Dockerfile index b275ec3b68..6819041a4e 100644 --- a/.ci/docker/Dockerfile +++ b/.ci/docker/Dockerfile @@ -111,7 +111,7 @@ RUN git clone https://github.com/verilator/verilator verilator \ FROM builder AS build-ghc -ARG ghcup_version="0.1.40.0" +ARG ghcup_version="0.1.50.2" # Must be explicitly set ARG ghc_version diff --git a/.ci/docker/build-and-publish-docker-image.sh b/.ci/docker/build-and-publish-docker-image.sh index ed0b9e6b2e..bb74d854e1 100755 --- a/.ci/docker/build-and-publish-docker-image.sh +++ b/.ci/docker/build-and-publish-docker-image.sh @@ -13,9 +13,9 @@ elif [[ "$1" != "" ]]; then echo "Unrecognized argument: $1" >&2 exit 1 fi -UBUNTU_VERSION=jammy-20250126 -GHC_VERSIONS=("9.10.2" "9.8.4" "9.6.7" "9.4.8" "9.2.8" "9.0.2" "8.10.7") -CABAL_VERSIONS=("3.14.2.0" "3.14.2.0" "3.14.2.0" "3.14.2.0" "3.14.2.0" "3.14.2.0" "3.12.1.0") +UBUNTU_VERSION=jammy-20251013 +GHC_VERSIONS=( "9.10.3" "9.8.4" "9.6.7") +CABAL_VERSIONS=("3.14.2.0" "3.14.2.0" "3.14.2.0") # We want to use docker buildkit so that our layers are built in parallel. This # is ignored completely on versions of docker which don't support buildkit. diff --git a/.ci/gitlab/benchmark.yml b/.ci/gitlab/benchmark.yml index 7c9a4bb0fd..419569a8cb 100644 --- a/.ci/gitlab/benchmark.yml +++ b/.ci/gitlab/benchmark.yml @@ -1,5 +1,5 @@ .benchmark: - image: ghcr.io/clash-lang/clash-ci:$GHC_VERSION-20251007 + image: ghcr.io/clash-lang/clash-ci:$GHC_VERSION-20251229 stage: test timeout: 2 hours variables: diff --git a/.ci/gitlab/common.yml b/.ci/gitlab/common.yml index 6a28ea6a91..3dc59a33f9 100644 --- a/.ci/gitlab/common.yml +++ b/.ci/gitlab/common.yml @@ -12,7 +12,7 @@ default: timeout: 10 minutes stage: build variables: - CLASH_DOCKER_TAG: 20251007 + CLASH_DOCKER_TAG: 20251229 CACHE_BUST_TOKEN: 3 # Note that we copy+paste the image name into CACHE_FALLBACK_KEY. If we don't, # $GHC_VERSION gets inserted at verbatim, instead of resolving to some ghc version. diff --git a/.ci/gitlab/test.yml b/.ci/gitlab/test.yml index 3470f247d3..f7dbb377b9 100644 --- a/.ci/gitlab/test.yml +++ b/.ci/gitlab/test.yml @@ -117,8 +117,7 @@ lib:unittests: ffi:interface-tests: extends: .test-nocache - # TODO: remove this when https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406 - # is fixed + # GHC 9.8.3, 9.8.4 and 9.10.2 have issues, see https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406 rules: - if: $SKIP_CLASH_FFI_EXAMPLE != "yes" script: @@ -154,8 +153,7 @@ ffi:example: extends: - .common-local - .nightly-rules - # TODO: remove this when https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406 - # is fixed + # GHC 9.8.3, 9.8.4 and 9.10.2 have issues, see https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406 rules: - if: $SKIP_CLASH_FFI_EXAMPLE != "yes" stage: test diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bf3a578b39..d4d3462690 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -147,7 +147,7 @@ jobs: # Run steps inside the clash CI docker image container: - image: ghcr.io/clash-lang/clash-ci:${{ matrix.ghc }}-20251007 + image: ghcr.io/clash-lang/clash-ci:${{ matrix.ghc }}-20251229 env: THREADS: 2 diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index b8b4eef6a2..1125d587d7 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -18,9 +18,9 @@ jobs: fail-fast: false matrix: ghc: [ - "ghc9101", - "ghc982", - "ghc964" + ghc9103, + ghc984, + ghc967 ] steps: - uses: actions/checkout@v4 @@ -65,9 +65,9 @@ jobs: fail-fast: false matrix: ghc: [ - "ghc9101", - "ghc982", - "ghc964" + ghc9103, + ghc984, + ghc967 ] package: [ "clash-benchmark", @@ -80,6 +80,10 @@ jobs: "clash-term", "clash-testsuite" ] + exclude: + - ghc: ghc984 + package: clash-ffi + needs: packages_common steps: - uses: actions/checkout@v4 @@ -108,9 +112,9 @@ jobs: fail-fast: false matrix: ghc: [ - ghc9101, - ghc982, - ghc964 + ghc9103, + ghc984, + ghc967 ] steps: - uses: actions/checkout@v4 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6c5805d0c1..ac514261a3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,15 +34,11 @@ tests: CI_PARENT_PIPELINE_SOURCE: $CI_PIPELINE_SOURCE parallel: matrix: - - GHC_VERSION: 9.10.2 - # TODO: remove this when https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406 - # is fixed - SKIP_CLASH_FFI_EXAMPLE: "yes" + - GHC_VERSION: 9.10.3 RUN_TESTS: "always" - GHC_VERSION: 9.8.4 - # TODO: remove this when https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406 - # is fixed + # GHC 9.8.3, 9.8.4 and 9.10.2 have issues, see https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406 SKIP_CLASH_FFI_EXAMPLE: "yes" RUN_TESTS: "always" diff --git a/changelog/2025-12-24T10_24_56+01_00_remove_Opt_LlvmTBAAe_unwanted b/changelog/2025-12-24T10_24_56+01_00_remove_Opt_LlvmTBAAe_unwanted new file mode 100644 index 0000000000..1bca83bae4 --- /dev/null +++ b/changelog/2025-12-24T10_24_56+01_00_remove_Opt_LlvmTBAAe_unwanted @@ -0,0 +1 @@ +clash-ghc: Remove "Opt_LlvmTBAA" from unwanted flags. See [#2508](https://github.com/clash-lang/clash-compiler/issues/2823). diff --git a/clash-ffi/clash-ffi.cabal b/clash-ffi/clash-ffi.cabal index fd2f155a1f..0ede0a28be 100644 --- a/clash-ffi/clash-ffi.cabal +++ b/clash-ffi/clash-ffi.cabal @@ -76,15 +76,15 @@ library Clash.FFI.VPI.Port Clash.FFI.VPI.Port.Direction Clash.FFI.VPI.Reg - -- TODO: remove this once https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406 - -- is fixed - if impl(ghc < 9.8.3) || impl(ghc == 9.10.1) + -- GHC 9.8.3, 9.8.4 and 9.10.2 have issues, see https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406 + if impl(ghc < 9.8.3) || impl(ghc == 9.10.1) || impl(ghc > 9.10.2) buildable: True else buildable: False -executable ffi-interface-tests +test-suite ffi-interface-tests import: common-options + type: exitcode-stdio-1.0 default-extensions: DataKinds RankNTypes @@ -113,9 +113,8 @@ executable ffi-interface-tests , tasty , tasty-hunit , tasty-smallcheck - -- TODO: remove this once https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406 - -- is fixed - if impl(ghc < 9.8.3) || impl(ghc == 9.10.1) + -- GHC 9.8.3, 9.8.4 and 9.10.2 have issues, see https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12264#note_602406 + if impl(ghc < 9.8.3) || impl(ghc == 9.10.1) || impl(ghc > 9.10.2) buildable: True else buildable: False diff --git a/clash-ghc/src-ghc/Clash/GHC/LoadModules.hs b/clash-ghc/src-ghc/Clash/GHC/LoadModules.hs index d104ffd7b0..2c49a6307d 100644 --- a/clash-ghc/src-ghc/Clash/GHC/LoadModules.hs +++ b/clash-ghc/src-ghc/Clash/GHC/LoadModules.hs @@ -887,9 +887,6 @@ unwantedOptimizationFlags df = , Opt_RegsGraph -- Don't care , Opt_RegsGraph -- Don't care , Opt_PedanticBottoms -- Stops eta-expansion through case: avoid -#if !MIN_VERSION_ghc(9,10,0) - , Opt_LlvmTBAA -- Don't care -#endif , Opt_CmmSink -- Don't care , Opt_CmmElimCommonBlocks -- Don't care , Opt_OmitYields -- Don't care diff --git a/clash-lib/clash-lib.cabal b/clash-lib/clash-lib.cabal index 91c4a8128f..e5ff093c9b 100644 --- a/clash-lib/clash-lib.cabal +++ b/clash-lib/clash-lib.cabal @@ -373,7 +373,7 @@ test-suite doctests build-depends: base, clash-lib, - doctest-parallel >= 0.2 && < 0.4, + doctest-parallel >= 0.2 && < 0.5, filepath test-suite unittests diff --git a/clash-prelude/clash-prelude.cabal b/clash-prelude/clash-prelude.cabal index 5e6f049d2c..19305a98fe 100644 --- a/clash-prelude/clash-prelude.cabal +++ b/clash-prelude/clash-prelude.cabal @@ -373,7 +373,7 @@ test-suite doctests build-depends: base, clash-prelude, - doctest-parallel >= 0.3.1 && < 0.4, + doctest-parallel >= 0.3.1 && < 0.5, filepath if arch(x86_64) && flag(workaround-ghc-mmap-crash) diff --git a/flake.lock b/flake.lock index 5101cbf0b5..d4552b079b 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", "owner": "edolstra", "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", "type": "github" }, "original": { @@ -21,11 +21,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -37,11 +37,11 @@ "ghc-tcplugin-api": { "flake": false, "locked": { - "lastModified": 1760038054, - "narHash": "sha256-8cF5dPdAT1cf3OdQwgcOy5BbfnJRNcxFgmSHgv+tB+4=", + "lastModified": 1768388673, + "narHash": "sha256-3RriTela4iwbvHhF3UigmBOfxJv0+YQGAlXQbnXsX74=", "owner": "sheaf", "repo": "ghc-tcplugin-api", - "rev": "b6407ef2ae4bfa0c25c628c8c6f69058257228eb", + "rev": "c583750b5899846cb455f3fe2d58b3ba9bc910d0", "type": "github" }, "original": { @@ -53,11 +53,11 @@ "ghc-typelits-extra": { "flake": false, "locked": { - "lastModified": 1764765869, - "narHash": "sha256-ynlFGRhTcXwG/fgpIk/GAy+mpvo8eBCptTuRWGl/YC4=", + "lastModified": 1768299328, + "narHash": "sha256-wL6rf3zuiK3AJsY1WFWgXnbjY0mJAMCK9PRs6rIBQHs=", "owner": "clash-lang", "repo": "ghc-typelits-extra", - "rev": "db8cfbd17a8c8984d28c8af254cc81860d8430a9", + "rev": "802efa673d781718b2776d73307a36ddded0666e", "type": "github" }, "original": { @@ -85,11 +85,11 @@ "ghc-typelits-natnormalise": { "flake": false, "locked": { - "lastModified": 1764714063, - "narHash": "sha256-fBjB3ms0rfIDmMFGx5z4aTfldpwfEqoliFePlRVoI7w=", + "lastModified": 1770072492, + "narHash": "sha256-YyJoKI0+HicJpXuUYEr3oS2L8Es3Z11GYayT0hj6+Bw=", "owner": "clash-lang", "repo": "ghc-typelits-natnormalise", - "rev": "c8131585b04c5c55f3e1da6e564107147306e274", + "rev": "ffba84b9ad1eab91cec25d7c265aac8e2cc2bc53", "type": "github" }, "original": { @@ -100,11 +100,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1727089097, - "narHash": "sha256-ZMHMThPsthhUREwDebXw7GX45bJnBCVbfnH1g5iuSPc=", + "lastModified": 1770537093, + "narHash": "sha256-pF1quXG5wsgtyuPOHcLfYg/ft/QMr8NnX0i6tW2187s=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "568bfef547c14ca438c56a0bece08b8bb2b71a9c", + "rev": "fef9403a3e4d31b0a23f0bacebbec52c248fbb51", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 61c42024b8..65b4eac7b5 100644 --- a/flake.nix +++ b/flake.nix @@ -36,16 +36,16 @@ # The versions of GHC that we want to be able to build / develop against # within the nix environment. Since nix is lazy, only derivations for # versions of GHC which are used are actually evaluated. - ghcVersions = [ "ghc964" "ghc982" "ghc9101" ]; + ghcVersions = [ "ghc967" "ghc984" "ghc9103" ]; # We pick a single version of GHC to use by default within nix. This is # probably cleaner than always having N copies of each package / app and # being forced to refer to them by their GHC version. - defaultGhcVersion = "ghc9101"; + defaultGhcVersion = "ghc9103"; # Overlays are not per-system, so let's only compute them once. # For each version of GHC we produce a `pkgs.clashPackages-ghcVER`, e.g. - # `pkgs.clashPackages-ghc962`. + # `pkgs.clashPackages-ghc967`. overlays = let makeOverlay = diff --git a/nix/devshell.nix b/nix/devshell.nix index 90b90fb185..255224fc46 100644 --- a/nix/devshell.nix +++ b/nix/devshell.nix @@ -26,11 +26,13 @@ pkgs.mkShell { # https://discourse.nixos.org/t/non-interactive-bash-errors-from-flake-nix-mkshell/33310 pkgs.bashInteractive - pkgs.ghdl-llvm pkgs.nixpkgs-fmt - pkgs.symbiyosys + pkgs.sby pkgs.verilator - pkgs.verilog + pkgs.iverilog pkgs.yosys - ]; + ] ++ + # depends on gnat14 which doesn't work ATM on aarch64: + # https://github.com/NixOS/nixpkgs/issues/469109 + pkgs.lib.optional (!pkgs.stdenv.hostPlatform.isAarch64) pkgs.ghdl-llvm; } diff --git a/nix/overlay-ghc910.nix b/nix/overlay-ghc910.nix index 19815b2674..f310fd6e8f 100644 --- a/nix/overlay-ghc910.nix +++ b/nix/overlay-ghc910.nix @@ -1,71 +1,23 @@ { pkgs }: final: prev: let - inherit (pkgs.haskell.lib) dontCheck doJailbreak markUnbroken; + inherit (pkgs.haskell.lib) doJailbreak dontCheck markUnbroken; in { # Use an older version than the default in nixpkgs. Since rewrite-inspector # is basically abandonware it catches fire with brick 1.0+. - brick = doJailbreak prev.brick_0_70_1; + brick = doJailbreak(prev.callHackage "brick" "0.70.1" { }); # brick 0.70.1 requires vty < 6.0. vty = doJailbreak (prev.callHackage "vty" "5.39" { }); - # Relies on older versions of some libraries. - hint = doJailbreak prev.hint; - # Marked as broken in nixpkgs, since it specifies much older dependencies # than the defaults in nixpkgs. rewrite-inspector = doJailbreak (markUnbroken prev.rewrite-inspector); - # Requires some old versions of libraries, but still works. - derive-storable-plugin = doJailbreak prev.derive-storable-plugin; - - # Marken as broken, but compiles anyway. - hedgehog-fakedata = doJailbreak (markUnbroken prev.hedgehog-fakedata); - - # Fails on GHC 9.10 with: - # library/Text/Regex/PCRE/Heavy.hs:123: failure in expression `head $ scan [re|\s*entry (\d+) (\w+)\s*&?|] (" entry 1 hello &entry 2 hi" :: String)' - # expected: (" entry 1 hello &",["1","hello"]) - # but got: :55:1: warning: [GHC-63394] [-Wx-partial] - # ^ - # In the use of ‘head’ - # (imported from Prelude.Compat, but defined in GHC.Internal.List): - # "This is a partial function, it throws an error on empty lists. Use pattern matching, 'Data.List.uncons' or 'Data.Maybe.listToMaybe' instead. Consider refactoring to use "Data.List.NonEmpty"." - # (" entry 1 hello &",["1","hello"]) - - pcre-heavy = dontCheck prev.pcre-heavy; - - # Relies on older versions of text. - string-random = doJailbreak prev.string-random; - - # We need the newest version from nixpkgs for these packages. - singletons-base = prev.singletons-base_3_4; - - microstache = prev.microstache_1_0_3; - - th-desugar = prev.th-desugar_1_17; - - # We need a new tasty-flaky. The one from Hackage doesn't build for some weird - # reason.. - tasty-flaky = prev.callCabal2nix "tasty-flaky" (pkgs.fetchFromGitHub { - owner = "LaurentRDC"; - repo = "tasty-flaky"; - rev = "fc31a9d622c1eb60030a50152258a9bef785e365"; - sha256 = "sha256-irLM3aVMxpBgsM72ArulMXcoLY2glalVkG//Lrj2JBI="; - }) {}; - - tasty = prev.tasty_1_5; - - singletons-th = prev.singletons-th_3_4; + # An ipv6 test fails on CI. Most likely due to missing kernel support? + network = dontCheck prev.network; - # nixplgs doesn't include revision 1, changing dependency on template-haskell. - string-interpolate = pkgs.haskell.lib.compose.overrideCabal (drv: { - revision = "1"; - editedCabalFile = "sha256-oh0tR+LDFcVzQnm4kSrmhAU+P7wdai536d72Cvhzipg="; - }) (prev.callHackageDirect { - pkg = "string-interpolate"; - ver = "0.3.4.0"; - sha256 = "sha256-KA8P6cc6N7pZ9/ay3edcEGx4vpKtp+EY7tn8U1NrbG8="; - } { }); + # Marked broken and bounds exclude newer GHC. But seems to work fine. + derive-storable-plugin = doJailbreak (markUnbroken prev.derive-storable-plugin); } diff --git a/nix/overlay-ghc96.nix b/nix/overlay-ghc96.nix index a518da71fd..474598372d 100644 --- a/nix/overlay-ghc96.nix +++ b/nix/overlay-ghc96.nix @@ -6,59 +6,26 @@ in { # Use an older version than the default in nixpkgs. Since rewrite-inspector # is basically abandonware it catches fire with brick 1.0+. - brick = doJailbreak prev.brick_0_70_1; + brick = doJailbreak(prev.callHackage "brick" "0.70.1" { }); - vty = prev.callHackage "vty" "5.39" { }; - - # Marked as broken in nixpkgs, since it needs on a newer hashable than the - # .cabal file currently uploaded to hackage. - concurrent-supply = doJailbreak (markUnbroken prev.concurrent-supply); - - # Use a branch with changes to support GHC 9.6.1. - hint = - prev.hint.overrideAttrs (_: { - src = - pkgs.fetchFromGitHub { - owner = "haskell-hint"; - repo = "hint"; - rev = "7803c34c8ae1d83c0f7c13fe6b30fcb3abd0ac51"; - hash = "sha256-ZFusrioxjDmWnDktD1evu7EjPG6brYpmmcaE2NWQKGA="; - }; - }); + # brick 0.70.1 requires vty < 6.0. + vty = doJailbreak (prev.callHackage "vty" "5.39" { }); # Marked as broken in nixpkgs, since it specifies much older dependencies # than the defaults in nixpkgs. rewrite-inspector = doJailbreak (markUnbroken prev.rewrite-inspector); - # Needs a newer text than the .cabal file currently uploaded to hackage. - string-qq = doJailbreak prev.string-qq; - - # Needs a newer base than the .cabal file currently uploaded to hackage. - vector-binary-instances = doJailbreak prev.vector-binary-instances; - - # type-errors 0.2.0.2 is bounded on doctest >=0.16.0.1 && <0.22 - doctest = prev.callHackage "doctest" "0.21.1" { }; - - # Marken as broken, but compiles anyway. - hedgehog-fakedata = doJailbreak (markUnbroken prev.hedgehog-fakedata); + derive-storable-plugin = markUnbroken prev.derive-storable-plugin; - # We need a new tasty-flaky. The one from Hackage doesn't build for some weird - # reason.. - tasty-flaky = prev.callCabal2nix "tasty-flaky" (pkgs.fetchFromGitHub { - owner = "LaurentRDC"; - repo = "tasty-flaky"; - rev = "fc31a9d622c1eb60030a50152258a9bef785e365"; - sha256 = "sha256-irLM3aVMxpBgsM72ArulMXcoLY2glalVkG//Lrj2JBI="; - }) {}; + # singletons-base/th 3.2 is the last version working on GHC 9.6 + singletons-th = prev.callHackage "singletons-th" "3.2" { }; + # Some tests fail, seems to be golden tests which might fail when output + # changes? + singletons-base = dontCheck (prev.callHackage "singletons-base" "3.2" { }); - # This version of tasty isn't available in the nix ghc96 package set - tasty = prev.callHackageDirect { - pkg = "tasty"; - ver = "1.5.3"; - sha256 = "sha256-Ogd8J4aHNeL+xmcRWuJeGBNaePyLs5yo1IoMzvWrVPY="; - } {}; + # singletons-th 3.2 requires th-desugar 1.15 + th-desugar = prev.callHackage "th-desugar" "1.15" { }; - # The tests (not the package itself!) require a tasty <1.5, which won't work as we pull in - # tasty 1.5.3. Solution: don't test! - time-compat = dontCheck prev.time-compat; + # th-desugar 1.15 requires th-abstraction 0.6 + th-abstraction = prev.callHackage "th-abstraction" "0.6.0.0" { }; } diff --git a/nix/overlay-ghc98.nix b/nix/overlay-ghc98.nix index 6565462473..353d8d849b 100644 --- a/nix/overlay-ghc98.nix +++ b/nix/overlay-ghc98.nix @@ -1,12 +1,12 @@ { pkgs }: final: prev: let - inherit (pkgs.haskell.lib) doJailbreak markUnbroken dontCheck; + inherit (pkgs.haskell.lib) doJailbreak markUnbroken overrideCabal; in { # Use an older version than the default in nixpkgs. Since rewrite-inspector # is basically abandonware it catches fire with brick 1.0+. - brick = doJailbreak prev.brick_0_70_1; + brick = doJailbreak(prev.callHackage "brick" "0.70.1" { }); # brick 0.70.1 requires vty < 6.0. vty = doJailbreak (prev.callHackage "vty" "5.39" { }); @@ -15,29 +15,15 @@ in # than the defaults in nixpkgs. rewrite-inspector = doJailbreak (markUnbroken prev.rewrite-inspector); - # Requires some old versions of libraries, but still works. - derive-storable-plugin = doJailbreak prev.derive-storable-plugin; + # singletons-base/th 3.3 is the last version working on GHC 9.8 + singletons-th = prev.callHackage "singletons-th" "3.3" { }; + singletons-base = prev.callHackage "singletons-base" "3.3" { }; - # Marken as broken, but compiles anyway. - hedgehog-fakedata = doJailbreak (markUnbroken prev.hedgehog-fakedata); + # singletons-th 3.3 requires th-desugar 1.16 + th-desugar = prev.callHackage "th-desugar" "1.16" { }; - # We need a new tasty-flaky. The one from Hackage doesn't build for some weird - # reason.. - tasty-flaky = prev.callCabal2nix "tasty-flaky" (pkgs.fetchFromGitHub { - owner = "LaurentRDC"; - repo = "tasty-flaky"; - rev = "fc31a9d622c1eb60030a50152258a9bef785e365"; - sha256 = "sha256-irLM3aVMxpBgsM72ArulMXcoLY2glalVkG//Lrj2JBI="; - }) {}; - - # This version of tasty isn't available in the nix ghc96 package set - tasty = prev.callHackageDirect { - pkg = "tasty"; - ver = "1.5.3"; - sha256 = "sha256-Ogd8J4aHNeL+xmcRWuJeGBNaePyLs5yo1IoMzvWrVPY="; - } {}; - - # The tests (not the package itself!) require a tasty <1.5, which won't work as we pull in - # tasty 1.5.3. Solution: don't test! - time-compat = dontCheck prev.time-compat; + # Broken on GHC 9.8.4 see clash-ffi cabal file for details + clash-ffi = overrideCabal prev.clash-ffi (drv: { + broken = true; + }); } diff --git a/nix/overlay.nix b/nix/overlay.nix index 72af61dfa0..d05528cb8d 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -21,6 +21,19 @@ let pkgs = prev; }; + # Some type checker plugins have tests that invoke GHC which requires the package + # themselves to be available. + ghc-typelits-plugins-preCheck-script = pkgName: '' + unset GHC_ENVIRONMENT + wrapper="''${TMPDIR:-/tmp}/ghc-for-tests" + cat > "$wrapper" <<'EOF' + #!/bin/sh + exec ghc -package-db "$PWD/dist/package.conf.inplace" -package ${pkgName} "$@" + EOF + chmod +x "$wrapper" + export HC="$wrapper" + ''; + # An overlay with the packages we pull in as inputs to this flake. # # This is mostly intended for packages developed by QBayLogic which are @@ -34,10 +47,15 @@ let { }; ghc-typelits-extra = - hprev.callCabal2nix - "ghc-typelits-extra" - "${ghc-typelits-extra}" - { }; + prev.haskell.lib.overrideCabal + (hprev.callCabal2nix + "ghc-typelits-extra" + "${ghc-typelits-extra}" + { } + ) + (drv: { + preCheck = ghc-typelits-plugins-preCheck-script "ghc-typelits-extra"; + }); ghc-typelits-knownnat = hprev.callCabal2nix @@ -46,10 +64,15 @@ let { }; ghc-typelits-natnormalise = - hprev.callCabal2nix - "ghc-typelits-natnormalise" - "${ghc-typelits-natnormalise}" - { }; + prev.haskell.lib.overrideCabal + (hprev.callCabal2nix + "ghc-typelits-natnormalise" + "${ghc-typelits-natnormalise}" + { } + ) + (drv: { + preCheck = ghc-typelits-plugins-preCheck-script "ghc-typelits-natnormalise"; + }); }; # An overlay with the packages in this repository. @@ -86,14 +109,16 @@ let in unmodified.overrideAttrs (old: { nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ - prev.verilog + prev.iverilog ]; }); + # Broken on GHC 9.8.4 clash-ffi = - hprev.callCabal2nix "clash-ffi" ../clash-ffi { - inherit (hfinal) clash-prelude; - }; + prev.haskell.lib.overrideCabal (hprev.callCabal2nix "clash-ffi" ../clash-ffi {}) + (drv: { + testFlags = [ "--smallcheck-max-count" "2000" ]; + }); clash-ghc = let @@ -197,32 +222,36 @@ let prev.makeWrapper ]; - postInstall = (old.postInstall or "") + '' + postInstall = let + # depends on gnat14 which doesn't work ATM on aarch64: + # https://github.com/NixOS/nixpkgs/issues/469109 + ghdl-llvm-opt = prev.lib.optional (!prev.stdenv.hostPlatform.isAarch64) prev.ghdl-llvm; + lib-deps = [ + prev.zlib.static + ] ++ ghdl-llvm-opt; + bin-deps = [ + prev.gcc + prev.sby + prev.verilator + prev.iverilog + prev.yosys + ] ++ ghdl-llvm-opt; + in (old.postInstall or "") + '' wrapProgram $out/bin/clash-testsuite \ --add-flags "--no-modelsim --no-vivado" \ --prefix PATH : ${dirOf "${old.passthru.env.NIX_GHC}"} \ --set GHC_PACKAGE_PATH "${old.passthru.env.NIX_GHC_LIBDIR}/package.conf.d:" \ - --prefix PATH : ${prev.lib.makeBinPath [ - prev.gcc - prev.ghdl-llvm - prev.symbiyosys - prev.verilator - prev.verilog - prev.yosys - ]} \ - --set LIBRARY_PATH ${prev.lib.makeLibraryPath [ - prev.ghdl-llvm - prev.zlib.static - ]} + --prefix PATH : ${prev.lib.makeBinPath bin-deps} \ + --set LIBRARY_PATH ${prev.lib.makeLibraryPath lib-deps} ''; }); }; haskellOverlays = prev.lib.composeManyExtensions [ - ghcOverlay haskellExternalPackages haskellInternalPackages + ghcOverlay ]; in {