blob: b11a133165bb24b6fae9bd13e934df77597fe876 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
{
config,
lib,
self,
unstable,
...
}: let
cfg = config.server.services.hercules-ci;
inherit (lib) mkEnableOption mkIf;
in {
options.server.services.hercules-ci = {
enable = mkEnableOption "enable hercules-ci";
secrets.enable = mkEnableOption "manage secrets for hercules-ci";
};
config = mkIf cfg.enable {
age.secrets = let
baseDir = "${self}/parts/secrets/systems/${config.networking.hostName}";
hercArgs = {
mode = "400";
owner = "hercules-ci-agent";
group = "hercules-ci-agent";
};
in
mkIf cfg.secrets.enable {
binaryCache =
{
file = "${baseDir}/binaryCache.age";
}
// hercArgs;
clusterToken =
{
file = "${baseDir}/clusterToken.age";
}
// hercArgs;
secretsJson =
{
file = "${baseDir}/secretsJson.age";
}
// hercArgs;
};
services = {
hercules-ci-agent = {
enable = true;
package = unstable.hercules-ci-agent;
settings = {
binaryCachesPath = config.age.secrets.binaryCache.path;
clusterJoinTokenPath = config.age.secrets.clusterToken.path;
secretsJsonPath = config.age.secrets.secretsJson.path;
};
};
};
};
}
|