79 lines
2.9 KiB
Nix
79 lines
2.9 KiB
Nix
# Gitea Actions runner "performance" for git.faumaray.com, running jobs in
|
|
# rootful Docker (dev/docker.nix). The registration token is an agenix secret:
|
|
# secrets/gitea-runner-token.age one line `TOKEN=<registration token>`
|
|
# (nix run .#secret-from-file -- gitea-runner-token.age <file>)
|
|
# Without that file the runner is not configured and a warning says so.
|
|
{ config, lib, ... }:
|
|
let
|
|
tokenSecret = config.meta.secretsDir + "/gitea-runner-token.age";
|
|
hasToken = builtins.pathExists tokenSecret;
|
|
in
|
|
{
|
|
flake.modules.nixos.gitea-runner =
|
|
{ config, pkgs, ... }:
|
|
{
|
|
age.secrets = lib.optionalAttrs hasToken {
|
|
gitea-runner-token = {
|
|
file = tokenSecret;
|
|
mode = "0400";
|
|
};
|
|
};
|
|
|
|
# An instance without token or tokenFile fails the upstream assertion, so
|
|
# the instance only exists when the secret does.
|
|
services.gitea-actions-runner.instances = lib.optionalAttrs hasToken {
|
|
performance = {
|
|
enable = true;
|
|
url = "https://git.faumaray.com";
|
|
name = "Perfrormance Runner";
|
|
tokenFile = config.age.secrets.gitea-runner-token.path;
|
|
labels = [
|
|
"ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
|
|
"voelin-release:docker://docker.gitea.com/runner-images:ubuntu-latest"
|
|
"ubuntu-24.04:docker://docker.gitea.com/runner-images:ubuntu-24.04"
|
|
"ubuntu-22.04:docker://docker.gitea.com/runner-images:ubuntu-22.04"
|
|
"echoion-release-serial:docker://git.faumaray.ru/void/echoion-release-builder:gcc-16.1.0"
|
|
"linux:host"
|
|
];
|
|
|
|
hostPackages = with pkgs; [
|
|
bashInteractive
|
|
coreutils
|
|
curl
|
|
gitMinimal
|
|
nix
|
|
nodejs_26
|
|
wget
|
|
];
|
|
settings = {
|
|
runner = {
|
|
capacity = 5;
|
|
timeout = "3h";
|
|
fetch_timeout = "5s";
|
|
fetch_interval = "1s";
|
|
};
|
|
cache = {
|
|
enabled = true;
|
|
host = "192.168.255.242"; # or "localhost" if not using isolated docker containers
|
|
port = 8088;
|
|
dir = "/var/lib/gitea-runner/cache";
|
|
};
|
|
container = {
|
|
# Ensure the job container passes standard bridge mode
|
|
network_mode = "bridge";
|
|
|
|
# Provide the job containers an alias to reach the host system
|
|
options = "--add-host=host.docker.internal:host-gateway";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
warnings = lib.optional (!hasToken) ''
|
|
The Gitea Actions runner "performance" is not configured: secrets/gitea-runner-token.age
|
|
is missing. Put `TOKEN=<new registration token>` in a file, then
|
|
`nix run .#secret-from-file -- gitea-runner-token.age <file>` and `git add` it.
|
|
'';
|
|
};
|
|
}
|