nix-config/modules/nixos/forgejo-runner/default.nix
2026-02-23 20:50:47 +01:00

79 lines
1.7 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.forgejo-runner;
inherit (lib)
mkEnableOption
mkIf
mkOption
types
;
in
{
options.services.forgejo-runner = {
enable = mkEnableOption "Nix-based Forgejo Runner service";
url = mkOption {
type = types.str;
description = "Forgejo instance URL.";
};
tokenFile = mkOption {
type = types.path;
description = "Path to EnvironmentFile containing TOKEN=...";
};
instance = mkOption {
type = types.str;
default = "default";
description = "Name of the runner instance.";
};
label = mkOption {
type = types.str;
default = "host";
description = "Runner label.";
};
};
config = mkIf cfg.enable {
nix.settings.trusted-users = [ "gitea-runner" ];
services.gitea-actions-runner = {
package = pkgs.forgejo-runner;
instances."${cfg.instance}" = {
enable = true;
name = "${config.networking.hostName}-nix";
inherit (cfg) url tokenFile;
labels = [ "${cfg.label}:host" ];
hostPackages = with pkgs; [
bash
coreutils
curl
deploy-rs
gitMinimal
gnused
nix
nodejs
openssh
];
settings = {
log.level = "info";
runner = {
capacity = 4;
envs = {
NIX_CONFIG = "extra-experimental-features = nix-command flakes";
NIX_REMOTE = "daemon";
# inherit (config.systemd.services."gitea-runner-${cfg.instance}".environment) HOME;
};
};
};
};
};
};
}