diff options
Diffstat (limited to 'nixos/modules/services/continuous-integration/hercules-ci-agent/common.nix')
-rw-r--r-- | nixos/modules/services/continuous-integration/hercules-ci-agent/common.nix | 55 |
1 files changed, 15 insertions, 40 deletions
diff --git a/nixos/modules/services/continuous-integration/hercules-ci-agent/common.nix b/nixos/modules/services/continuous-integration/hercules-ci-agent/common.nix index 4aed493c0fb0a..24884655c660f 100644 --- a/nixos/modules/services/continuous-integration/hercules-ci-agent/common.nix +++ b/nixos/modules/services/continuous-integration/hercules-ci-agent/common.nix @@ -9,7 +9,15 @@ Platform-specific code is in the respective default.nix files. { config, lib, options, pkgs, ... }: let - inherit (lib) mkOption mkIf types filterAttrs literalExample mkRenamedOptionModule; + inherit (lib) + filterAttrs + literalExample + mkIf + mkOption + mkRemovedOptionModule + mkRenamedOptionModule + types + ; cfg = config.services.hercules-ci-agent; @@ -77,10 +85,11 @@ let }; }; + # TODO (2022) remove checkNix = if !cfg.checkNix then "" - else if lib.versionAtLeast config.nix.package.version "2.4.0" + else if lib.versionAtLeast config.nix.package.version "2.3.10" then "" else pkgs.stdenv.mkDerivation { name = "hercules-ci-check-system-nix-src"; @@ -88,23 +97,12 @@ let configurePhase = ":"; buildPhase = '' echo "Checking in-memory pathInfoCache expiry" - if ! grep 'struct PathInfoCacheValue' src/libstore/store-api.hh >/dev/null; then + if ! grep 'PathInfoCacheValue' src/libstore/store-api.hh >/dev/null; then cat 1>&2 <<EOF You are deploying Hercules CI Agent on a system with an incompatible - nix-daemon. Please - - either upgrade Nix to version 2.4.0 (when released), - - or set option services.hercules-ci-agent.patchNix = true; - - or set option nix.package to a build of Nix 2.3 with this patch applied: - https://github.com/NixOS/nix/pull/3405 - - The patch is required for Nix-daemon clients that expect a change in binary - cache contents while running, like the agent's evaluator. Without it, import - from derivation will fail if your cluster has more than one machine. - We are conservative with changes to the overall system, which is why we - keep changes to a minimum and why we ask for confirmation in the form of - services.hercules-ci-agent.patchNix = true before applying. - + nix-daemon. Please make sure nix.package is set to a Nix version of at + least 2.3.10 or a master version more recent than Mar 12, 2020. EOF exit 1 fi @@ -112,26 +110,13 @@ let installPhase = "touch $out"; }; - patchedNix = lib.mkIf (!lib.versionAtLeast pkgs.nix.version "2.4.0") ( - if lib.versionAtLeast pkgs.nix.version "2.4pre" - then lib.warn "Hercules CI Agent module will not patch 2.4 pre-release. Make sure it includes (equivalently) PR #3043, commit d048577909 or is no older than 2020-03-13." pkgs.nix - else pkgs.nix.overrideAttrs ( - o: { - patches = (o.patches or []) ++ [ backportNix3398 ]; - } - ) - ); - - backportNix3398 = pkgs.fetchurl { - url = "https://raw.githubusercontent.com/hercules-ci/hercules-ci-agent/hercules-ci-agent-0.7.3/for-upstream/issue-3398-path-info-cache-ttls-backport-2.3.patch"; - sha256 = "0jfckqjir9il2il7904yc1qyadw366y7xqzg81sp9sl3f1pw70ib"; - }; in { imports = [ (mkRenamedOptionModule ["services" "hercules-ci-agent" "extraOptions"] ["services" "hercules-ci-agent" "settings"]) (mkRenamedOptionModule ["services" "hercules-ci-agent" "baseDirectory"] ["services" "hercules-ci-agent" "settings" "baseDirectory"]) (mkRenamedOptionModule ["services" "hercules-ci-agent" "concurrentTasks"] ["services" "hercules-ci-agent" "settings" "concurrentTasks"]) + (mkRemovedOptionModule ["services" "hercules-ci-agent" "patchNix"] "Nix versions packaged in this version of Nixpkgs don't need a patched nix-daemon to work correctly in Hercules CI Agent clusters.") ]; options.services.hercules-ci-agent = { @@ -147,15 +132,6 @@ in Support is available at <link xlink:href="mailto:help@hercules-ci.com">help@hercules-ci.com</link>. ''; }; - patchNix = mkOption { - type = types.bool; - default = false; - description = '' - Fix Nix 2.3 cache path metadata caching behavior. Has the effect of <literal>nix.package = patch pkgs.nix;</literal> - - This option will be removed when Hercules CI Agent moves to Nix 2.4 (upcoming Nix release). - ''; - }; checkNix = mkOption { type = types.bool; default = true; @@ -206,7 +182,6 @@ in # even shortly after the previous lookup. This *also* applies to the daemon. narinfo-cache-negative-ttl = 0 ''; - nix.package = mkIf cfg.patchNix patchedNix; services.hercules-ci-agent.tomlFile = format.generate "hercules-ci-agent.toml" cfg.settings; }; |