fix(sops, gitea-runner): decode token as dotenv, not yaml

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.
This commit is contained in:
oqyude committed 2026-10-19 18:23:18 +03:00
1 parent 7a0e7d560e
commit 71826d3b99
1 file changed
+10 -3
+10 -3
View File
@@ -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";