10 format = pkgs.formats.toml { };
20 freeformType = format.type;
22 apiBaseUrl = mkOption {
24 API base URL that the agent will connect to.
26 When using Hercules CI Enterprise, set this to the URL where your
27 Hercules CI server is reachable.
30 default = "https://hercules-ci.com";
32 baseDirectory = mkOption {
34 default = "/var/lib/hercules-ci-agent";
36 State directory (secrets, work directory, etc) for agent
39 concurrentTasks = mkOption {
41 Number of tasks to perform simultaneously.
43 A task is a single derivation build, an evaluation or an effect run.
44 At minimum, you need 2 concurrent tasks for `x86_64-linux`
45 in your cluster, to allow for import from derivation.
47 `concurrentTasks` can be around the CPU core count or lower if memory is
50 The optimal value depends on the resource consumption characteristics of your workload,
51 including memory usage and in-task parallelism. This is typically determined empirically.
53 When scaling, it is generally better to have a double-size machine than two machines,
54 because each split of resources causes inefficiencies; particularly with regards
55 to build latency because of extra downloads.
57 type = types.either types.ints.positive (types.enum [ "auto" ]);
59 defaultText = lib.literalMD ''
60 `"auto"`, meaning equal to the number of CPU cores.
65 A key-value map of user data.
67 This data will be available to organization members in the dashboard and API.
69 The values can be of any TOML type that corresponds to a JSON type, but arrays
70 can not contain tables/objects due to limitations of the TOML library. Values
71 involving arrays of non-primitive types may not be representable currently.
74 defaultText = literalExpression ''
76 agent.source = "..."; # One of "nixpkgs", "flake", "override"
82 workDirectory = mkOption {
84 The directory in which temporary subdirectories are created for task state. This includes sources for Nix evaluation.
87 default = config.baseDirectory + "/work";
88 defaultText = literalExpression ''baseDirectory + "/work"'';
90 staticSecretsDirectory = mkOption {
92 This is the default directory to look for statically configured secrets like `cluster-join-token.key`.
94 See also `clusterJoinTokenPath` and `binaryCachesPath` for fine-grained configuration.
97 default = config.baseDirectory + "/secrets";
98 defaultText = literalExpression ''baseDirectory + "/secrets"'';
100 clusterJoinTokenPath = mkOption {
102 Location of the cluster-join-token.key file.
104 You can retrieve the contents of the file when creating a new agent via
105 <https://hercules-ci.com/dashboard>.
107 As this value is confidential, it should not be in the store, but
108 installed using other means, such as agenix, NixOps
109 `deployment.keys`, or manual installation.
111 The contents of the file are used for authentication between the agent and the API.
114 default = config.staticSecretsDirectory + "/cluster-join-token.key";
115 defaultText = literalExpression ''staticSecretsDirectory + "/cluster-join-token.key"'';
117 binaryCachesPath = mkOption {
119 Path to a JSON file containing binary cache secret keys.
121 As these values are confidential, they should not be in the store, but
122 copied over using other means, such as agenix, NixOps
123 `deployment.keys`, or manual installation.
125 The format is described on <https://docs.hercules-ci.com/hercules-ci-agent/binary-caches-json/>.
128 default = config.staticSecretsDirectory + "/binary-caches.json";
129 defaultText = literalExpression ''staticSecretsDirectory + "/binary-caches.json"'';
131 secretsJsonPath = mkOption {
133 Path to a JSON file containing secrets for effects.
135 As these values are confidential, they should not be in the store, but
136 copied over using other means, such as agenix, NixOps
137 `deployment.keys`, or manual installation.
139 The format is described on <https://docs.hercules-ci.com/hercules-ci-agent/secrets-json/>.
142 default = config.staticSecretsDirectory + "/secrets.json";
143 defaultText = literalExpression ''staticSecretsDirectory + "/secrets.json"'';
149 if packageOption.highestPrio == (lib.modules.mkOptionDefault { }).priority then
152 lib.mkOptionDefault "override";
153 pkgs.version = pkgs.lib.version;
154 lib.version = lib.version;
160 inherit format settingsModule;