[NixOS] Add separate gitea-runner configuration

This commit is contained in:
Ivan Malison 2023-09-24 22:45:43 -06:00
parent f85d2f4a6d
commit 21505f23f3
6 changed files with 53 additions and 8 deletions

View File

@ -13,6 +13,7 @@
./games.nix
./git-sync.nix
./gitea.nix
./gitea-runner.nix
./imalison.nix
./internet-computer.nix
./kat.nix

50
nixos/gitea-runner.nix Normal file
View File

@ -0,0 +1,50 @@
{ pkgs, config, makeEnable, ... }:
makeEnable config "modules.gitea-runner" false {
age.secrets.gitea-runner-token = {
file = ./secrets/gitea-runner-token.${config.networking.hostName}.age;
owner = "gitea";
group = "docker";
};
services.gitea-actions-runner.instances.nix =
let gitea-runner-directory = "/var/lib/gitea-runner";
in {
settings = {
cache = {
enabled = true;
};
container = {
workdir_parent = "${gitea-runner-directory}/workspace";
};
host = {
workdir_parent = "${gitea-runner-directory}/action-cache-dir";
};
};
hostPackages = with pkgs; [
bash
coreutils
curl
gawk
git-lfs
nixFlakes
gitFull
gnused
nodejs
wget
];
enable = true;
name = config.networking.hostName;
url = "http://1896Folsom.duckdns.org:3000";
tokenFile = config.age.secrets.gitea-runner-token.path;
labels = [
"nixos-${pkgs.system}:host"
"nix:docker://localhost:5921/nix-runner"
];
};
systemd.services.gitea-runner-nix.environment =
let gitea-runner-directory = "/var/lib/gitea-runner"; in {
XDG_CONFIG_HOME = gitea-runner-directory;
XDG_CACHE_HOME = "${gitea-runner-directory}/.cache";
};
}

View File

@ -1,6 +1,5 @@
{ config, makeEnable, ... }:
makeEnable config "modules.gitea" false {
age.secrets."gitea-runner-token".file = ./secrets/gitea-runner-token.age;
services.gitea = {
enable = true;
@ -10,11 +9,4 @@ makeEnable config "modules.gitea" false {
SSH_PORT = 1123;
};
};
services.gitea-actions-runner.instances-nix-runner = {
enable = true;
url = config.services.gitea.settings.server.ROOT_URL;
tokenFile = config.age.secrets.gitea-runner-token.path;
labels = [ "nixos:host" ];
};
}

View File

@ -9,6 +9,7 @@
# Needed for now because monitors have different refresh rates
modules.xmonad.picom.vSync.enable = false;
modules.cache-server.enable = true;
modules.gitea-runner.enable = true;
boot.loader.systemd-boot.configurationLimit = 5;

Binary file not shown.

View File

@ -5,4 +5,5 @@ in
"gpg-passphrase.age".publicKeys = keys.agenixKeys;
"cache-priv-key.pem.age".publicKeys = keys.agenixKeys;
"gitea-runner-token.age".publicKeys = keys.agenixKeys;
"gitea-runner-token.ryzen-shine.age".publicKeys = keys.agenixKeys;
}