nixfiles/nixos/boxes/colony/vms/git/gitea-actions.nix

79 lines
1.8 KiB
Nix
Raw Normal View History

2023-11-13 13:24:08 +00:00
{ lib, pkgs, config, ... }:
let
inherit (builtins) toJSON;
inherit (lib) mkForce;
inherit (lib.my.c) pubDomain;
cfgFile = pkgs.writeText "gitea-actions-runner.yaml" (toJSON {
container = {
2023-12-09 15:22:01 +00:00
# network = "colony";
2023-11-17 02:36:32 +00:00
privileged = true;
2023-11-13 13:24:08 +00:00
};
cache = {
enabled = true;
dir = "/var/cache/gitea-runner";
};
2023-11-13 13:24:08 +00:00
});
in
{
config = {
fileSystems = {
"/var/cache/gitea-runner" = {
device = "/dev/disk/by-label/actions-cache";
fsType = "ext4";
};
};
2023-11-13 13:24:08 +00:00
services = {
gitea-actions-runner.instances = {
main = {
enable = true;
name = "main-docker";
2023-11-17 02:36:32 +00:00
labels = [
2023-11-18 15:59:48 +00:00
"debian-node-bullseye:docker://node:18-bullseye"
2023-11-17 02:36:32 +00:00
"ubuntu-22.04:docker://git.nul.ie/dev/actions-ubuntu:22.04"
];
2023-11-13 13:24:08 +00:00
url = "https://git.${pubDomain}";
tokenFile = config.age.secrets."gitea/actions-runner.env".path;
};
};
};
users = with lib.my.c.ids; {
users = {
gitea-runner = {
isSystemUser = true;
uid = uids.gitea-runner;
group = "gitea-runner";
home = "/var/lib/gitea-runner";
};
};
groups = {
gitea-runner.gid = gids.gitea-runner;
};
};
systemd = {
services = {
gitea-runner-main.serviceConfig = {
# Needs to be able to read its secrets
CacheDirectory = "gitea-runner";
2023-11-13 13:24:08 +00:00
DynamicUser = mkForce false;
User = "gitea-runner";
Group = "gitea-runner";
ExecStart = mkForce "${config.services.gitea-actions-runner.package}/bin/act_runner -c ${cfgFile} daemon";
};
};
};
my = {
secrets.files = {
"gitea/actions-runner.env" = {
owner = "gitea-runner";
group = "gitea-runner";
};
};
};
};
}