nixos-modules/pp-forgejo-runner.nix

42 lines
1.2 KiB
Nix

{ lib, config, pkgs, ... }:
with lib;
let
cfgBase = config.base;
cfg = config.services.ppForgejoRunner;
in
{
options.services.ppForgejoRunner = {
forgeUrl = mkOption {
type = types.str;
default = "https://git.${cfgBase.domainName}";
example = "https://git.example.com";
description = "The domain of the forgejo server";
};
runnerName = mkOption {
type = types.str;
default = "${cfgBase.name}.${cfgBase.domainName}";
example = "git-runner.example.com";
description = "The name of the runner";
};
tokenFile = mkOption {
type = types.str;
default = "/etc/forgejo_runner_token";
description = "The file containing the token to access forgejo. Be sure to secure it. The content of the file must be of the form TOKEN=<token>";
};
};
config = {
virtualisation.podman.enable = true;
services.gitea-actions-runner.package = pkgs.forgejo-actions-runner;
services.gitea-actions-runner.instances."${cfg.runnerName}" = {
enable = true;
name = cfg.runnerName;
url = cfg.forgeUrl;
tokenFile = cfg.tokenFile;
labels = [
"debian:docker://debian:bookworm"
];
};
};
}