git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #112637 from hercules-ci/hercules-ci-agent-maintenance

nixos/hercules-ci-agent: maintenance

commit075e1f7ee453fb696aeb9c3aa6aed187d3f85d05 authorRobert Hensing <roberth@users.noreply.github.com> dateWed 10 Feb 2021, 11:02 (6 years ago) parent938f013696294e
2 files changed+36−32
nixos/modules/services/continuous-integration/hercules-ci-agent/common.nix+32−28 nixos/modules/services/continuous-integration/hercules-ci-agent/default.nix+4−4
nixos/modules/services/continuous-integration/hercules-ci-agent/common.nix+32−28
@@ -7,7 +7,6 @@ Platform-specific code is in the respective default.nix files.
77 */
88
99{ config, lib, options, pkgs, ... }:
10−
1110let
1211 inherit (lib)
1312 filterAttrs
@@ -22,7 +21,7 @@ let
2221 cfg =
2322 config.services.hercules-ci-agent;
2423
25− format = pkgs.formats.toml {};
24+ format = pkgs.formats.toml { };
2625
2726 settingsModule = { config, ... }: {
2827 freeformType = format.type;
@@ -36,10 +35,14 @@ let
3635 };
3736 concurrentTasks = mkOption {
3837 description = ''
39− Number of tasks to perform simultaneously, such as evaluations, derivations.
38+ Number of tasks to perform simultaneously.
39+
40+ A task is a single derivation build or an evaluation.
41+ At minimum, you need 2 concurrent tasks for <literal>x86_64-linux</literal>
42+ in your cluster, to allow for import from derivation.
4043
41− You must have a total capacity across agents of at least 2 concurrent tasks on <literal>x86_64-linux</literal>
42− to allow for import from derivation.
44+ <literal>concurrentTasks</literal> can be around the CPU core count or lower if memory is
45+ the bottleneck.
4346 '';
4447 type = types.int;
4548 default = 4;
@@ -85,38 +88,39 @@ let
8588 };
8689 };
8790
88− # TODO (2022) remove
91+ # TODO (roberth, >=2022) remove
8992 checkNix =
9093 if !cfg.checkNix
9194 then ""
9295 else if lib.versionAtLeast config.nix.package.version "2.3.10"
9396 then ""
94− else pkgs.stdenv.mkDerivation {
95− name = "hercules-ci-check-system-nix-src";
96− inherit (config.nix.package) src patches;
97− configurePhase = ":";
98− buildPhase = ''
99− echo "Checking in-memory pathInfoCache expiry"
100− if ! grep 'PathInfoCacheValue' src/libstore/store-api.hh >/dev/null; then
101− cat 1>&2 <<EOF
102−
103− You are deploying Hercules CI Agent on a system with an incompatible
104− nix-daemon. Please make sure nix.package is set to a Nix version of at
105− least 2.3.10 or a master version more recent than Mar 12, 2020.
106− EOF
107− exit 1
108− fi
109− '';
110− installPhase = "touch $out";
111− };
97+ else
98+ pkgs.stdenv.mkDerivation {
99+ name = "hercules-ci-check-system-nix-src";
100+ inherit (config.nix.package) src patches;
101+ configurePhase = ":";
102+ buildPhase = ''
103+ echo "Checking in-memory pathInfoCache expiry"
104+ if ! grep 'PathInfoCacheValue' src/libstore/store-api.hh >/dev/null; then
105+ cat 1>&2 <<EOF
106+
107+ You are deploying Hercules CI Agent on a system with an incompatible
108+ nix-daemon. Please make sure nix.package is set to a Nix version of at
109+ least 2.3.10 or a master version more recent than Mar 12, 2020.
110+ EOF
111+ exit 1
112+ fi
113+ '';
114+ installPhase = "touch $out";
115+ };
112116
113117in
114118{
115119 imports = [
116− (mkRenamedOptionModule ["services" "hercules-ci-agent" "extraOptions"] ["services" "hercules-ci-agent" "settings"])
117− (mkRenamedOptionModule ["services" "hercules-ci-agent" "baseDirectory"] ["services" "hercules-ci-agent" "settings" "baseDirectory"])
118− (mkRenamedOptionModule ["services" "hercules-ci-agent" "concurrentTasks"] ["services" "hercules-ci-agent" "settings" "concurrentTasks"])
119− (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.")
120+ (mkRenamedOptionModule [ "services" "hercules-ci-agent" "extraOptions" ] [ "services" "hercules-ci-agent" "settings" ])
121+ (mkRenamedOptionModule [ "services" "hercules-ci-agent" "baseDirectory" ] [ "services" "hercules-ci-agent" "settings" "baseDirectory" ])
122+ (mkRenamedOptionModule [ "services" "hercules-ci-agent" "concurrentTasks" ] [ "services" "hercules-ci-agent" "settings" "concurrentTasks" ])
123+ (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.")
120124 ];
121125
122126 options.services.hercules-ci-agent = {
nixos/modules/services/continuous-integration/hercules-ci-agent/default.nix+4−4
@@ -7,9 +7,7 @@ Code that is shared with nix-darwin goes in common.nix.
77 */
88
99{ pkgs, config, lib, ... }:
10−
1110let
12−
1311 inherit (lib) mkIf mkDefault;
1412
1513 cfg = config.services.hercules-ci-agent;
@@ -21,7 +19,7 @@ in
2119{
2220 imports = [
2321 ./common.nix
24− (lib.mkRenamedOptionModule ["services" "hercules-ci-agent" "user"] ["systemd" "services" "hercules-ci-agent" "serviceConfig" "User"])
22+ (lib.mkRenamedOptionModule [ "services" "hercules-ci-agent" "user" ] [ "systemd" "services" "hercules-ci-agent" "serviceConfig" "User" ])
2523 ];
2624
2725 config = mkIf cfg.enable {
@@ -80,6 +78,8 @@ in
8078 isSystemUser = true;
8179 };
8280
83− users.groups.hercules-ci-agent = {};
81+ users.groups.hercules-ci-agent = { };
8482 };
83+
84+ meta.maintainers = [ lib.maintainers.roberth ];
8585}