From 7596bdf26585c5322298a8f606cce3e6af7c6aa9 Mon Sep 17 00:00:00 2001 From: Alex Tunstall Date: Fri, 19 Apr 2024 20:56:17 +0100 Subject: [PATCH] Run a Hydra server The test suites for gbenchmark, hypothesis, libopus, sh, and tornado time out. httplib2's test suite indirectly depends on selenium, which doesn't build on RISC-V. https://github.com/SeleniumHQ/selenium/pull/13194 The other disabled test suites fail for various cryptic reasons. --- modules/services/default.nix | 2 ++ modules/services/hydra.nix | 55 ++++++++++++++++++++++++++++++++++++ overlays/riscv-fixes.nix | 26 +++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 modules/services/hydra.nix diff --git a/modules/services/default.nix b/modules/services/default.nix index b77947c..08d39cb 100644 --- a/modules/services/default.nix +++ b/modules/services/default.nix @@ -1,5 +1,7 @@ { ... }: { + imports = [ ./hydra.nix ]; + services.getty.autologinUser = "root"; services.openssh = { diff --git a/modules/services/hydra.nix b/modules/services/hydra.nix new file mode 100644 index 0000000..d578bce --- /dev/null +++ b/modules/services/hydra.nix @@ -0,0 +1,55 @@ +{ config, pkgs, ... }: + +# Much of this module is based on or copied from the NixOS Hydra configuration +# See https://github.com/NixOS/infra/blob/master/delft/hydra.nix + +{ + services.hydra = { + enable = true; + hydraURL = "http://hydra.riscv.tunstall.xyz/"; + notificationSender = "unused@localhost"; + extraConfig = '' + # NixOS Hydra bans IFD therefore so shall we + allow_import_from_derivation = false + + # Limit the evaluator memory usage a bit + evaluator_workers = 1 + evaluator_max_memory_size = 4096 + max_concurrent_evals = 1 + + max_output_size = 3221225472 # 3 << 30 = 3 GB + + # The default Git timeout (600) is too low to fetch Nixpkgs + + timeout = 86400 + + ''; + }; + + services.nginx = { + enable = true; + recommendedGzipSettings = true; + recommendedOptimisation = true; + recommendedProxySettings = true; + recommendedTlsSettings = true; + + virtualHosts."hydra.riscv.tunstall.xyz" = { + locations."/".proxyPass = "http://localhost:3000/"; + }; + }; + + # Work around https://github.com/NixOS/hydra/issues/1337 + services.hydra.package = pkgs.hydra_unstable.overrideAttrs (final: prev: { + postPatch = '' + ${prev.postPatch or ""} + rm src/lib/Hydra/Plugin/DeclarativeJobsets.pm + rm t/Hydra/Plugin/DeclarativeJobsets/basic.t + ''; + }); + + networking.firewall.allowedTCPPorts = [ 80 ]; + + # Hydra and nix-daemon must use the same package otherwise hydra-eval-jobs is + # prone to crashing + nix.package = config.services.hydra.package.passthru.nix; +} diff --git a/overlays/riscv-fixes.nix b/overlays/riscv-fixes.nix index 1f2605f..fc17198 100644 --- a/overlays/riscv-fixes.nix +++ b/overlays/riscv-fixes.nix @@ -16,6 +16,17 @@ in { NIX_CFLAGS_COMPILE = "${NIX_CFLAGS_COMPILE} -Wno-error=cast-align"; }); + folly = super.folly.overrideAttrs ({ meta ? {}, ... }: { + meta = meta // { + platforms = (meta.platforms or []) ++ [ "riscv64-linux" ]; + }; + }); + + gbenchmark = dontCheck super.gbenchmark; + + # The default gn does not recognise RISC-V + gn = self.gn1924; + haskell = super.haskell // { packages = super.haskell.packages // { ghc964 = super.haskell.packages.ghc964.override { @@ -27,7 +38,10 @@ in { }; }; + hydra_unstable = dontCheck super.hydra_unstable; + libbsd = dontCheck super.libbsd; + libopus = dontCheck super.libopus; libuv = dontCheck super.libuv; # Fails in ./configure when LuaJIT isn't available @@ -38,12 +52,24 @@ in { ''; }); + perlPackages = super.perlPackages.overrideScope (plSelf: plSuper: { + Test2Harness = dontCheck plSuper.Test2Harness; + UUID4Tiny = dontCheck plSuper.UUID4Tiny; + }); + pixman = dontCheck super.pixman; protobuf = dontCheck super.protobuf; pythonPackagesExtensions = super.pythonPackagesExtensions ++ [ (pySelf: pySuper: { + executing = pyDontCheck pySuper.executing; + httplib2 = pyDontCheck pySuper.httplib2; + hypothesis = pyDontCheck pySuper.hypothesis; + numpy = pyDontCheck pySuper.numpy; + paramiko = pyDontCheck pySuper.paramiko; + sh = pyDontCheck pySuper.sh; sphinx = pyDontCheck pySuper.sphinx; + tornado = pyDontCheck pySuper.tornado; }) ]; }