From 7a3a2d13564a1e99c72adf75e9de90f8ae47ec0d Mon Sep 17 00:00:00 2001 From: oqyude Date: Wed, 14 Oct 2026 17:48:35 +0300 Subject: [PATCH] fix(sops, gitea-runner): decode token as dotenv, not yaml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nixpkgs's services.gitea-actions-runner.module uses EnvironmentFile= instance.tokenFile; systemd reads KEY=VALUE lines, not YAML. The previous key="registration_token" with format="yaml" produced /var/lib/gitea-runner/ registration-token as YAML, which systemd silently failed to parse — the runner process received an empty $TOKEN and Gitea replied with "runner registration token not found". Switch to format="dotenv" and drop the key= parameter (dotenv has no key concept, the file is one TOKEN=... line). The companion secret file is renamed accordingly: secrets/gitea-runner-registration.yaml → secrets/gitea-runner-registration.env Verified at 2026-10-14 17:36 MSK on sapphira with token in place — register + declare succeed, runner shows up green in Gitea admin UI. --- modules/server/gitea-runner.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/server/gitea-runner.nix b/modules/server/gitea-runner.nix index ab676df..43c95c5 100644 --- a/modules/server/gitea-runner.nix +++ b/modules/server/gitea-runner.nix @@ -25,10 +25,17 @@ in # bind mount would then cover it and silently drop the token on remount. # See invariants #2 (external disk mount order) and #7 (sops path). sops.secrets.gitea-runner-registration = { + # systemd's EnvironmentFile (consumed by the upstream NixOS + # services.gitea-actions-runner module) reads KEY=VALUE lines, not + # YAML. sops with format = "dotenv" decodes to that — the runner's + # ExecStartPre script exports `TOKEN="$TOKEN"` from the file. The + # previous key="registration_token" / format="yaml" combination + # decoded to a YAML body that EnvironmentFile could not parse, so + # the runner received no $TOKEN at all and Gitea replied + # "runner registration token not found". path = "/var/lib/gitea-runner/registration-token"; - format = "yaml"; - key = "registration_token"; - sopsFile = ../../secrets/gitea-runner-registration.yaml; + format = "dotenv"; + sopsFile = ../../secrets/gitea-runner-registration.env; owner = "gitea-runner"; group = "gitea-runner"; mode = "0440";