diff --git a/.ci/build_nix.sh b/.ci/build_nix.sh new file mode 100755 index 0000000000..b174bb0125 --- /dev/null +++ b/.ci/build_nix.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -u + +nix \ + --extra-experimental-features nix-command \ + --extra-experimental-features flakes \ + build -j$THREADS --log-format raw --max-silent-time 3600 "$@" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1081410b4f..34d41c4e16 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -73,8 +73,21 @@ nix-build: stage: test before_script: - nix-env -i gawk + - export THREADS=$(./.ci/effective_cpus.sh) + - export script: - - nix-build -j$(./.ci/effective_cpus.sh) --log-format raw --max-silent-time 3600 + - .ci/build_nix.sh .#clash-prelude + - .ci/build_nix.sh .#clash-prelude-hedgehog + - .ci/build_nix.sh .#clash-lib + - .ci/build_nix.sh .#clash-lib-hedgehog + - .ci/build_nix.sh .#clash-ghc + - .ci/build_nix.sh .#clash-cosim + - .ci/build_nix.sh .#clash-ffi + - .ci/build_nix.sh .#clash-testsuite + - .ci/build_nix.sh .#clash-benchmark + - .ci/build_nix.sh .#clash-profiling-prepare + - .ci/build_nix.sh .#clash-profiling + - .ci/build_nix.sh .#clash-term tags: - local diff --git a/nix/overlay-ghc910.nix b/nix/overlay-ghc910.nix new file mode 100644 index 0000000000..19815b2674 --- /dev/null +++ b/nix/overlay-ghc910.nix @@ -0,0 +1,71 @@ +{ pkgs }: +final: prev: +let + inherit (pkgs.haskell.lib) dontCheck doJailbreak 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 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; + + # 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="; + } { }); +}