2023-01-28 20:49:10 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
self,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
2022-08-13 18:38:41 +00:00
|
|
|
psCfg = config.pub-solar;
|
|
|
|
cfg = config.pub-solar.ci-runner;
|
2023-01-28 20:49:10 +00:00
|
|
|
in {
|
2022-08-13 18:38:41 +00:00
|
|
|
options.pub-solar.ci-runner = {
|
|
|
|
enable = mkEnableOption "Enables a systemd service that runs drone-ci-runner";
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2022-08-13 20:31:30 +00:00
|
|
|
systemd.user.services.ci-runner = {
|
2022-08-13 18:38:41 +00:00
|
|
|
enable = true;
|
|
|
|
|
|
|
|
description = "CI runner for the PubSolarOS repository that can run test VM instances with KVM.";
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
|
|
|
Restart = "always";
|
|
|
|
};
|
|
|
|
|
2022-08-14 18:24:50 +00:00
|
|
|
path = [
|
|
|
|
pkgs.git
|
|
|
|
pkgs.nix
|
2022-08-25 13:25:34 +00:00
|
|
|
pkgs.libvirt
|
2022-08-14 18:24:50 +00:00
|
|
|
];
|
2022-08-13 20:31:30 +00:00
|
|
|
|
2023-01-28 20:49:10 +00:00
|
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
after = ["network.target" "libvirtd.service"];
|
2022-08-13 18:38:41 +00:00
|
|
|
|
|
|
|
script = ''${pkgs.drone-runner-exec}/bin/drone-runner-exec daemon /run/agenix/drone-runner-exec-config'';
|
|
|
|
};
|
|
|
|
|
|
|
|
age.secrets."drone-runner-exec-config" = {
|
|
|
|
file = "${self}/secrets/drone-runner-exec-config";
|
|
|
|
mode = "700";
|
2022-08-13 20:31:30 +00:00
|
|
|
owner = psCfg.user.name;
|
2022-08-13 18:38:41 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|