nixos/hercules-ci-agent: Update module

Changed files
+69 -14
nixos
modules
services
continuous-integration
hercules-ci-agent
+66 -11
nixos/modules/services/continuous-integration/hercules-ci-agent/common.nix
···
/*
-
This file is for options that NixOS and nix-darwin have in common.
-
Platform-specific code is in the respective default.nix files.
-
*/
{ config, lib, options, pkgs, ... }:
let
···
settingsModule = { config, ... }: {
freeformType = format.type;
options = {
baseDirectory = mkOption {
type = types.path;
default = "/var/lib/hercules-ci-agent";
···
type = types.either types.ints.positive (types.enum [ "auto" ]);
default = "auto";
};
workDirectory = mkOption {
description = ''
The directory in which temporary subdirectories are created for task state. This includes sources for Nix evaluation.
···
staticSecretsDirectory = mkOption {
description = ''
This is the default directory to look for statically configured secrets like <literal>cluster-join-token.key</literal>.
'';
type = types.path;
default = config.baseDirectory + "/secrets";
···
clusterJoinTokenPath = mkOption {
description = ''
Location of the cluster-join-token.key file.
'';
type = types.path;
default = config.staticSecretsDirectory + "/cluster-join-token.key";
defaultText = literalExpression ''staticSecretsDirectory + "/cluster-join-token.key"'';
-
# internal: It's a bit too detailed to show by default in the docs,
-
# but useful to define explicitly to allow reuse by other modules.
-
internal = true;
};
binaryCachesPath = mkOption {
description = ''
-
Location of the binary-caches.json file.
'';
type = types.path;
default = config.staticSecretsDirectory + "/binary-caches.json";
defaultText = literalExpression ''staticSecretsDirectory + "/binary-caches.json"'';
-
# internal: It's a bit too detailed to show by default in the docs,
-
# but useful to define explicitly to allow reuse by other modules.
-
internal = true;
};
};
};
···
These are written as options instead of let binding to allow sharing with
default.nix on both NixOS and nix-darwin.
-
*/
tomlFile = mkOption {
type = types.path;
internal = true;
···
/*
+
This file is for options that NixOS and nix-darwin have in common.
+
Platform-specific code is in the respective default.nix files.
+
*/
{ config, lib, options, pkgs, ... }:
let
···
settingsModule = { config, ... }: {
freeformType = format.type;
options = {
+
apiBaseUrl = mkOption {
+
description = ''
+
API base URL that the agent will connect to.
+
+
When using Hercules CI Enterprise, set this to the URL where your
+
Hercules CI server is reachable.
+
'';
+
type = types.str;
+
default = "https://hercules-ci.com";
+
};
baseDirectory = mkOption {
type = types.path;
default = "/var/lib/hercules-ci-agent";
···
type = types.either types.ints.positive (types.enum [ "auto" ]);
default = "auto";
};
+
labels = mkOption {
+
description = ''
+
A key-value map of user data.
+
+
This data will be available to organization members in the dashboard and API.
+
+
The values can be of any TOML type that corresponds to a JSON type, but arrays
+
can not contain tables/objects due to limitations of the TOML library. Values
+
involving arrays of non-primitive types may not be representable currently.
+
'';
+
type = format.type;
+
defaultText = literalExpression ''
+
{
+
agent.source = "..."; # One of "nixpkgs", "flake", "override"
+
lib.version = "...";
+
pkgs.version = "...";
+
}
+
'';
+
};
workDirectory = mkOption {
description = ''
The directory in which temporary subdirectories are created for task state. This includes sources for Nix evaluation.
···
staticSecretsDirectory = mkOption {
description = ''
This is the default directory to look for statically configured secrets like <literal>cluster-join-token.key</literal>.
+
+
See also <literal>clusterJoinTokenPath</literal> and <literal>binaryCachesPath</literal> for fine-grained configuration.
'';
type = types.path;
default = config.baseDirectory + "/secrets";
···
clusterJoinTokenPath = mkOption {
description = ''
Location of the cluster-join-token.key file.
+
+
You can retrieve the contents of the file when creating a new agent via
+
<link xlink:href="https://hercules-ci.com/dashboard">https://hercules-ci.com/dashboard</link>.
+
+
As this value is confidential, it should not be in the store, but
+
installed using other means, such as agenix, NixOps
+
<literal>deployment.keys</literal>, or manual installation.
+
+
The contents of the file are used for authentication between the agent and the API.
'';
type = types.path;
default = config.staticSecretsDirectory + "/cluster-join-token.key";
defaultText = literalExpression ''staticSecretsDirectory + "/cluster-join-token.key"'';
};
binaryCachesPath = mkOption {
description = ''
+
Path to a JSON file containing binary cache secret keys.
+
+
As these values are confidential, they should not be in the store, but
+
copied over using other means, such as agenix, NixOps
+
<literal>deployment.keys</literal>, or manual installation.
+
+
The format is described on <link xlink:href="https://docs.hercules-ci.com/hercules-ci-agent/binary-caches-json/">https://docs.hercules-ci.com/hercules-ci-agent/binary-caches-json/</link>.
'';
type = types.path;
default = config.staticSecretsDirectory + "/binary-caches.json";
defaultText = literalExpression ''staticSecretsDirectory + "/binary-caches.json"'';
+
};
+
secretsJsonPath = mkOption {
+
description = ''
+
Path to a JSON file containing secrets for effects.
+
+
As these values are confidential, they should not be in the store, but
+
copied over using other means, such as agenix, NixOps
+
<literal>deployment.keys</literal>, or manual installation.
+
+
The format is described on <link xlink:href="https://docs.hercules-ci.com/hercules-ci-agent/secrets-json/">https://docs.hercules-ci.com/hercules-ci-agent/secrets-json/</link>.
+
+
'';
+
type = types.path;
+
default = config.staticSecretsDirectory + "/secrets.json";
+
defaultText = literalExpression ''staticSecretsDirectory + "/secrets.json"'';
};
};
};
···
These are written as options instead of let binding to allow sharing with
default.nix on both NixOS and nix-darwin.
+
*/
tomlFile = mkOption {
type = types.path;
internal = true;
+3 -3
nixos/modules/services/continuous-integration/hercules-ci-agent/default.nix
···
/*
-
This file is for NixOS-specific options and configs.
-
Code that is shared with nix-darwin goes in common.nix.
-
*/
{ pkgs, config, lib, ... }:
let
···
/*
+
This file is for NixOS-specific options and configs.
+
Code that is shared with nix-darwin goes in common.nix.
+
*/
{ pkgs, config, lib, ... }:
let