dotfiles/modules/nixos/services/gitea-runner.nix

54 lines
1.5 KiB
Nix
Raw Normal View History

2023-07-10 22:00:48 +00:00
{ config, pkgs, lib, ... }:
{
options.giteaRunner.enable =
lib.mkEnableOption "Enable Gitea Actions runner.";
config = lib.mkIf config.giteaRunner.enable {
services.gitea-actions-runner.instances.${config.networking.hostName} = {
enable = true;
labels = [
# Provide a Debian base with NodeJS for actions
2023-07-16 03:33:35 +00:00
# "debian-latest:docker://node:18-bullseye"
2023-07-10 22:00:48 +00:00
# Fake the Ubuntu name, because Node provides no Ubuntu builds
2023-07-16 03:33:35 +00:00
# "ubuntu-latest:docker://node:18-bullseye"
2023-07-10 22:00:48 +00:00
# Provide native execution on the host using below packages
"native:host"
];
hostPackages = with pkgs; [
bash
coreutils
curl
gawk
gitMinimal
gnused
nodejs
wget
];
name = config.networking.hostName;
url = "https://${config.hostnames.git}";
tokenFile = config.secrets.giteaRunnerToken.dest;
};
2023-07-16 03:33:35 +00:00
secrets.giteaRunnerToken = {
source = ../../../private/gitea-runner-token.age; # TOKEN=xyz
dest = "${config.secretsDirectory}/gitea-runner-token";
};
systemd.services.giteaRunnerToken-secret = {
requiredBy = [
"gitea-runner-${
config.services.gitea-actions-runner.instances.${config.networking.hostName}.name
}.service"
];
before = [
"gitea-runner-${
config.services.gitea-actions-runner.instances.${config.networking.hostName}.name
}.service"
];
};
2023-07-10 22:00:48 +00:00
};
}