From 21505f23f3cf903cf1a6d53f1ac31c6819ff539d Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Sun, 24 Sep 2023 22:45:43 -0600 Subject: [PATCH] [NixOS] Add separate gitea-runner configuration --- nixos/configuration.nix | 1 + nixos/gitea-runner.nix | 50 ++++++++++++++++++ nixos/gitea.nix | 8 --- nixos/machines/ryzen-shine.nix | 1 + .../gitea-runner-token.ryzen-shine.age | Bin 0 -> 2305 bytes nixos/secrets/secrets.nix | 1 + 6 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 nixos/gitea-runner.nix create mode 100644 nixos/secrets/gitea-runner-token.ryzen-shine.age diff --git a/nixos/configuration.nix b/nixos/configuration.nix index a07274f9..1aa16069 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -13,6 +13,7 @@ ./games.nix ./git-sync.nix ./gitea.nix + ./gitea-runner.nix ./imalison.nix ./internet-computer.nix ./kat.nix diff --git a/nixos/gitea-runner.nix b/nixos/gitea-runner.nix new file mode 100644 index 00000000..b2d5c637 --- /dev/null +++ b/nixos/gitea-runner.nix @@ -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"; + }; +} diff --git a/nixos/gitea.nix b/nixos/gitea.nix index 969a0483..1d72524b 100644 --- a/nixos/gitea.nix +++ b/nixos/gitea.nix @@ -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" ]; - }; } diff --git a/nixos/machines/ryzen-shine.nix b/nixos/machines/ryzen-shine.nix index e50628d2..24cfd0aa 100644 --- a/nixos/machines/ryzen-shine.nix +++ b/nixos/machines/ryzen-shine.nix @@ -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; diff --git a/nixos/secrets/gitea-runner-token.ryzen-shine.age b/nixos/secrets/gitea-runner-token.ryzen-shine.age new file mode 100644 index 0000000000000000000000000000000000000000..9b19260c1d620045cecc72f456de79b1f47374d0 GIT binary patch literal 2305 zcmZXUJInM48HTNc3O2%aHhH zcz((=lpv7(E-DB2#_Yzt->>TBBBy4*hy8=YxF@K;xyC6?UB)pQ2^Tv75B)L(>b@h; zz>UTILT*w?`)29RxqQf?0pslG_-MsZGbN9f@mI8%&75+_NV0uwbSSsa1$pb7Sr6SOrY?>P17tUEu^y~Gfr`?yRUr=L=8*>(R854junT{$ZYYyoUzg$zV!axJjQXkiSQcPBkZQgAug z)02r*IdDJz36_0)wnH5XG8Zvg08Q*io>TDQ1Zl^yJN`BpLS(th{1p&<7Xvx^8WIy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M^ZBf9w8wczW-LZ-4dEZ~ykkpMLM_MET^JnKt{lZ881uA9izyJUM literal 0 HcmV?d00001 diff --git a/nixos/secrets/secrets.nix b/nixos/secrets/secrets.nix index 10abe652..dc16780a 100644 --- a/nixos/secrets/secrets.nix +++ b/nixos/secrets/secrets.nix @@ -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; }