From 6f048a34664ffebcdbe0b6d4d20b56a458cb47c4 Mon Sep 17 00:00:00 2001 From: Drew Hess Date: Sun, 31 Aug 2025 18:20:14 +0100 Subject: [PATCH 1/4] chore: remove benchmarks for now Signed-off-by: Drew Hess --- flake.nix | 45 +-------------------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/flake.nix b/flake.nix index b00eb81dc..561af0c8f 100644 --- a/flake.nix +++ b/flake.nix @@ -102,7 +102,7 @@ getHIEs = package: getLibHIE package ++ pkgs.lib.concatMap (getHIE package) - [ "benchmarks" "exes" "sublibs" "tests" ]; + [ "exes" "sublibs" "tests" ]; primer-packages = pkgs.haskell-nix.haskellLib.selectProjectPackages pkgs.primer; in pkgs.runCommand "weeder" @@ -194,12 +194,8 @@ }; packages = { - inherit (pkgs) primer-benchmark; } // (pkgs.lib.optionalAttrs (system == "x86_64-linux") { - inherit (pkgs) primer-benchmark-results-json; - inherit (pkgs) primer-criterion-results-github-action-benchmark; - inherit (pkgs) primer-benchmark-results-github-action-benchmark; }) // primerFlake.packages; @@ -252,7 +248,6 @@ }; in (pkgs.lib.mapAttrs (name: pkg: mkApp pkg name) { - inherit (pkgs) primer-benchmark; }) // primerFlake.apps; @@ -362,10 +357,6 @@ ghcOptions = [ "-Werror" ]; preCheck = preCheckTasty; }; - primer-benchmark = { - ghcOptions = [ "-Werror" ]; - preCheck = preCheckTasty; - }; }; } { @@ -418,7 +409,6 @@ { packages.primer.components.tests.primer-test.testFlags = hide-successes ++ size-cutoff; packages.primer-api.components.tests.primer-api-test.testFlags = hide-successes ++ size-cutoff; - packages.primer-benchmark.components.tests.primer-benchmark-test.testFlags = hide-successes; } ) ]; @@ -469,33 +459,6 @@ }; primerFlake = primer.flake { }; - - # Note: these benchmarks should only be run (in CI) on a - # "benchmark" machine. This is enforced for our CI system - # via Nix's `requiredSystemFeatures`. - # - # The `lastEnvChange` value is an impurity that we can - # modify when we want to force a new benchmark run - # despite the benchmarking code not having changed, as - # otherwise Nix will cache the results. It's intended to - # be used to track changes to the benchmarking - # environment, such as changes to hardware, that Nix - # doesn't know about. - # - # The value should be formatted as an ISO date, followed - # by a "." and a 2-digit monotonic counter, to allow for - # multiple changes on the same date. We store this value - # in a `lastEnvChange` file in the derivation output, so - # that we can examine results in the Nix store and know - # which benchmarking environment was used to generate - # them. - benchmarks = - let - lastEnvChange = "20240408.02"; - in - final.callPackage ./nix/pkgs/benchmarks { - inherit lastEnvChange; - }; in { lib = (prev.lib or { }) // { @@ -506,12 +469,6 @@ inherit primer; - primer-benchmark = primerFlake.packages."primer-benchmark:bench:primer-benchmark"; - - inherit (benchmarks) primer-benchmark-results-json; - inherit (benchmarks) primer-criterion-results-github-action-benchmark; - inherit (benchmarks) primer-benchmark-results-github-action-benchmark; - inherit (ghc982Tools) cabal-fmt hlint ghcid; } ); From 85c2774b3d8b984441092d072493d68084ad6ff4 Mon Sep 17 00:00:00 2001 From: Drew Hess Date: Sun, 31 Aug 2025 18:26:48 +0100 Subject: [PATCH 2/4] chore: use our `pretty-show` fork for all targets Upstream uses `happy`, but that doesn't work for `wasi32` targets. Signed-off-by: Drew Hess --- cabal.project | 16 ++++++++-------- flake.nix | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/cabal.project b/cabal.project index 0c79a448a..81e152ef7 100644 --- a/cabal.project +++ b/cabal.project @@ -56,6 +56,14 @@ source-repository-package tag: ba94173bd8ff22110e65beb51c66cdf1172ce677 --sha256: 0nqdmxddmcd5c74mbw7yxsg8849rfmvaqq8afmw6ap8qfzr7dax2 +-- Upstream requires `happy` at build time, which doesn't work on Wasm +-- targets. +source-repository-package + type: git + location: https://github.com/hackworthltd/pretty-show + tag: 91d119cb0e3c5f7d866589b25158739580c8fc88 + --sha256: sha256-mu8Eq0Sg6nCF8C2sXB6ebZcLhz8TVZAbNMiorA7RVc8= + -- Wasm workarounds. -- -- We would prefer that these workarounds were not Wasm-dependent; @@ -68,11 +76,3 @@ source-repository-package if arch(wasm32) -- Required for TemplateHaskell support on Wasm targets. shared: True - - -- Upstream requires `happy` at build time, which doesn't work on Wasm - -- targets. - source-repository-package - type: git - location: https://github.com/hackworthltd/pretty-show - tag: 91d119cb0e3c5f7d866589b25158739580c8fc88 - --sha256: sha256-mu8Eq0Sg6nCF8C2sXB6ebZcLhz8TVZAbNMiorA7RVc8= diff --git a/flake.nix b/flake.nix index 561af0c8f..19c49cc18 100644 --- a/flake.nix +++ b/flake.nix @@ -391,7 +391,6 @@ packages.bytestring-builder.writeHieFiles = false; packages.fail.writeHieFiles = false; packages.diagrams.writeHieFiles = false; - packages.happy-lib.writeHieFiles = false; } { #TODO This shouldn't be necessary - see the commented-out `build-tool-depends` in primer.cabal. From 05f45f88e3ea803743a0c7a4ac101da1b6975544 Mon Sep 17 00:00:00 2001 From: Drew Hess Date: Sun, 31 Aug 2025 20:43:34 +0100 Subject: [PATCH 3/4] feat: add `wasi32` cross target Signed-off-by: Drew Hess --- flake.nix | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index 19c49cc18..41213dbf0 100644 --- a/flake.nix +++ b/flake.nix @@ -85,7 +85,9 @@ # haskell.nix does a lot of heavy lifiting for us and gives us a # flake for our Cabal project with the following attributes: # `checks`, `apps`, and `packages`. - primerFlake = pkgs.primer.flake { }; + primerFlake = pkgs.primer.flake { + crossPlatforms = p: [ p.wasi32 ]; + }; weeder = let @@ -193,11 +195,9 @@ }; }; - packages = { - } - // (pkgs.lib.optionalAttrs (system == "x86_64-linux") { - }) - // primerFlake.packages; + packages = { } + // (pkgs.lib.optionalAttrs (system == "x86_64-linux") { }) + // primerFlake.packages; checks = { # Disabled, as it doesn't currently build with Nix. @@ -247,8 +247,7 @@ program = "${pkg}/bin/${script}"; }; in - (pkgs.lib.mapAttrs (name: pkg: mkApp pkg name) { - }) + (pkgs.lib.mapAttrs (name: pkg: mkApp pkg name) { }) // primerFlake.apps; treefmt.config = @@ -413,6 +412,8 @@ ]; shell = { + crossPlatforms = p: [ p.wasi32 ]; + # We're using a `source-repository-package`, so we must disable this. # See: # https://github.com/hackworthltd/primer/issues/876 @@ -457,7 +458,9 @@ }; }; - primerFlake = primer.flake { }; + primerFlake = primer.flake { + crossPlatforms = p: [ p.wasi32 ]; + }; in { lib = (prev.lib or { }) // { From 72eac9bd3bccf0f9a4d62d5b8bfd1e0fdbb3258d Mon Sep 17 00:00:00 2001 From: Drew Hess Date: Wed, 15 Oct 2025 23:28:37 +0300 Subject: [PATCH 4/4] ci: remove non-haskell.nix Wasm build Signed-off-by: Drew Hess --- .buildkite/primer-wasm.yaml | 41 ------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 .buildkite/primer-wasm.yaml diff --git a/.buildkite/primer-wasm.yaml b/.buildkite/primer-wasm.yaml deleted file mode 100644 index 5deaa9577..000000000 --- a/.buildkite/primer-wasm.yaml +++ /dev/null @@ -1,41 +0,0 @@ -# Note: because they take so much time to run, we only run the Primer -# Wasm tests when one of these conditions is true: -# -# 1. The PR has hit the merge queue. -# 2. The PR has the "Run Wasm tests" label. - -agents: - queue: "nix-build" - os: "linux" - -steps: - # Note: only one of these should run during any given build. - # Unfortunately, Buildkite doesn't support if-else conditionals, so - # this gets a bit tricky. - - - label: ":haskell: :linux: Primer Wasm tests" - if: | - build.branch =~ /^gh-readonly-queue\// || - build.pull_request.labels includes "Run Wasm tests" - command: | - nix develop .#wasm --print-build-logs --command make -f Makefile.wasm32 update - nix develop .#wasm --print-build-logs --command make -f Makefile.wasm32 frontend-prod - nix develop .#wasm --print-build-logs --command make -f Makefile.wasm32 test - - - label: ":haskell: :linux: Primer Wasm build" - if: | - build.branch !~ /^gh-readonly-queue\// && - !(build.pull_request.labels includes "Run Wasm tests") - command: | - nix develop .#wasm --print-build-logs --command make -f Makefile.wasm32 update - nix develop .#wasm --print-build-logs --command make -f Makefile.wasm32 frontend-prod - - - label: ":haskell: :macos: Primer Wasm build" - if: | - build.branch !~ /^gh-readonly-queue\// && - !(build.pull_request.labels includes "Run Wasm tests") - command: | - nix develop --no-sandbox .#wasm --print-build-logs --command make -f Makefile.wasm32 update - nix develop --no-sandbox .#wasm --print-build-logs --command make -f Makefile.wasm32 frontend-prod - agents: - os: "darwin"