Skip to content

Commit abe2eb7

Browse files
radicle-ci-broker: init at 0.21.0, radicle-native-ci: init at 0.11.1 (NixOS#436583)
2 parents 54c83c5 + c88215b commit abe2eb7

10 files changed

Lines changed: 706 additions & 0 deletions

File tree

nixos/doc/manual/release-notes/rl-2511.section.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@
6060

6161
- [go-httpbin](https://github.com/mccutchen/go-httpbin), a reasonably complete and well-tested golang port of httpbin, with zero dependencies outside the go stdlib. Available as [services.go-httpbin](#opt-services.go-httpbin.enable).
6262

63+
- [radicle-ci-broker](https://app.radicle.xyz/nodes/seed.radicle.xyz/rad:zwTxygwuz5LDGBq255RA2CbNGrz8), runs CI for repositories in the local [Radicle](https://radicle.xyz/) node. Available as [services.radicle.ci.broker.enable](#opt-services.radicle.ci.broker.enable).
64+
65+
- [radicle-native-ci](https://app.radicle.xyz/nodes/seed.radicle.xyz/rad:z3qg5TKmN83afz2fj9z3fQjU8vaYE), an adapter for the [Radicle CI broker](https://app.radicle.xyz/nodes/seed.radicle.xyz/rad:zwTxygwuz5LDGBq255RA2CbNGrz8), for performing CI runs locally. Available as [services.radicle.ci.adapters.native](#opt-services.radicle.ci.adapters.native.instances).
66+
6367
- [llama-swap](https://github.com/mostlygeek/llama-swap), a light weight transparent proxy server that provides automatic model swapping to llama.cpp's server (or any server with an OpenAI compatible endpoint). Available as [](#opt-services.llama-swap.enable).
6468

6569
- [tuwunel](https://matrix-construct.github.io/tuwunel/), a federated chat server implementing the Matrix protocol, forked from Conduwuit. Available as [services.matrix-tuwunel](#opt-services.matrix-tuwunel.enable).

nixos/modules/module-list.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,8 @@
506506
./services/continuous-integration/jenkins/default.nix
507507
./services/continuous-integration/jenkins/job-builder.nix
508508
./services/continuous-integration/jenkins/slave.nix
509+
./services/continuous-integration/radicle/adapters/native.nix
510+
./services/continuous-integration/radicle/ci-broker.nix
509511
./services/continuous-integration/woodpecker/agents.nix
510512
./services/continuous-integration/woodpecker/server.nix
511513
./services/databases/aerospike.nix
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
{
2+
config,
3+
lib,
4+
pkgs,
5+
...
6+
}:
7+
8+
let
9+
cfg = config.services.radicle.ci.adapters.native;
10+
brokerCfg = config.services.radicle.ci.broker;
11+
12+
settingsFormat = pkgs.formats.yaml { };
13+
14+
enabledInstances = lib.filter (instance: instance.enable) (lib.attrValues cfg.instances);
15+
in
16+
17+
{
18+
meta.maintainers = with lib.maintainers; [ defelo ];
19+
20+
options.services.radicle.ci.adapters.native = {
21+
instances = lib.mkOption {
22+
type = lib.types.attrsOf (
23+
lib.types.submodule (
24+
{ config, name, ... }:
25+
{
26+
options = {
27+
enable = lib.mkEnableOption "this radicle-native-ci instance" // {
28+
default = true;
29+
example = false;
30+
};
31+
32+
name = lib.mkOption {
33+
type = lib.types.str;
34+
description = ''
35+
Adapter name that is used in the radicle-ci-broker configuration.
36+
Defaults to the attribute name.
37+
'';
38+
};
39+
40+
package = lib.mkPackageOption pkgs "radicle-native-ci" { };
41+
42+
runtimePackages = lib.mkOption {
43+
type = lib.types.listOf lib.types.package;
44+
description = "Packages added to the adapter's {env}`PATH`.";
45+
defaultText = lib.literalExpression ''
46+
with pkgs; [
47+
bash
48+
coreutils
49+
curl
50+
gawk
51+
gitMinimal
52+
gnused
53+
wget
54+
]
55+
'';
56+
};
57+
58+
settings = lib.mkOption {
59+
type = lib.types.submodule {
60+
freeformType = settingsFormat.type;
61+
62+
options = {
63+
state = lib.mkOption {
64+
type = lib.types.path;
65+
description = "Directory where per-run directories are stored.";
66+
defaultText = lib.literalExpression ''"''${config.services.radicle.ci.broker.stateDir}/adapters/native/${config.name}"'';
67+
};
68+
69+
log = lib.mkOption {
70+
type = lib.types.path;
71+
description = "File where radicle-native-ci should write the run log.";
72+
defaultText = lib.literalExpression ''"''${config.services.radicle.ci.broker.logDir}/adapters/native/${config.name}.log"'';
73+
};
74+
75+
base_url = lib.mkOption {
76+
type = lib.types.nullOr lib.types.str;
77+
description = "Base URL for build logs (mandatory for access from CI broker page).";
78+
default = null;
79+
};
80+
};
81+
};
82+
description = ''
83+
Configuration of radicle-native-ci.
84+
See <https://app.radicle.xyz/nodes/seed.radicle.xyz/rad:z3qg5TKmN83afz2fj9z3fQjU8vaYE#configuration> for more information.
85+
'';
86+
default = { };
87+
};
88+
};
89+
90+
config = {
91+
name = lib.mkDefault name;
92+
93+
runtimePackages = with pkgs; [
94+
bash
95+
coreutils
96+
curl
97+
gawk
98+
gitMinimal
99+
gnused
100+
wget
101+
];
102+
103+
settings = {
104+
state = lib.mkDefault "${brokerCfg.stateDir}/adapters/native/${config.name}";
105+
log = lib.mkDefault "${brokerCfg.logDir}/adapters/native/${config.name}.log";
106+
};
107+
};
108+
}
109+
)
110+
);
111+
description = "radicle-native-ci adapter instances.";
112+
default = { };
113+
};
114+
};
115+
116+
config = lib.mkIf (enabledInstances != [ ]) {
117+
services.radicle.ci.broker.settings.adapters = lib.listToAttrs (
118+
map (
119+
instance:
120+
lib.nameValuePair instance.name {
121+
command = lib.getExe instance.package;
122+
config = instance.settings;
123+
config_env = "RADICLE_NATIVE_CI";
124+
env.PATH = lib.makeBinPath instance.runtimePackages;
125+
}
126+
) enabledInstances
127+
);
128+
129+
systemd.tmpfiles.settings.radicle-native-ci = lib.listToAttrs (
130+
map (
131+
instance:
132+
lib.nameValuePair (builtins.dirOf instance.settings.log) {
133+
d = {
134+
user = config.users.users.radicle.name;
135+
group = config.users.groups.radicle.name;
136+
};
137+
}
138+
) enabledInstances
139+
);
140+
};
141+
}

0 commit comments

Comments
 (0)