From 6a6ddc4681c0ffe8a00b541a159067ad375ed3b1 Mon Sep 17 00:00:00 2001 From: oqyude Date: Wed, 14 Oct 2026 20:14:58 +0300 Subject: [PATCH] fix(gitea-runner): workspace outside the StateDirectory symlink to private/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The NixOS gitea-actions-runner module sets StateDirectory to private/gitea-runner (mode 700 in /var/lib/), so symlink /var/lib/gitea-runner -> private/gitea-runner resolves into a root-only directory tree. The static gitea-runner user (uid 973) cannot traverse that tree → mkdir within host.workdir_parent failed with EACCES. Move workdir_parent to /var/lib/gitea-runner-work (sibling of the symlink, no parent traversal through /var/lib/private). tmpfiles creates it owned by gitea-runner with mode 0755. Also still using rootfs to avoid the bind-mount RO issue that bit earlier. --- modules/server/gitea-runner.nix | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/server/gitea-runner.nix b/modules/server/gitea-runner.nix index 9df7092..97ee6d8 100644 --- a/modules/server/gitea-runner.nix +++ b/modules/server/gitea-runner.nix @@ -67,12 +67,12 @@ in health_check.interval = "5m"; health_check.timeout = "30s"; - # Workspace on rootfs (not on the /mnt/services bind mount) — observed - # in 2026-10-14 16:04/16:11 runs that a transient RO remount of the - # bind during nixos-rebuild activation surfaces as - # mkdir …: read-only file system - # to act_runner. Workdir on /var/lib survives activation cycles. - host.workdir_parent = "/var/lib/gitea-runner/work"; + # Workspace on rootfs, outside the StateDirectory symlink at + # /var/lib/gitea-runner -> private/gitea-runner. The NixOS module + # drops /var/lib/private/* at mode 700 (root-only) so the runner + # user can't traverse into the symlink target. Use a sibling of + # the symlink instead — /var/lib/gitea-runner-work (mode 0755 in tmpfiles). + host.workdir_parent = "/var/lib/gitea-runner-work"; # Defence in depth even though host labels never pull images. container.docker_host = ""; @@ -93,10 +93,10 @@ in # ----- Workspace directory on rootfs -------------------------------------- # `d` creates if missing; `z` resets ownership if missing. Path is - # /var/lib/gitea-runner/work (rootfs), not on the external bind mount — - # see comment on `host.workdir_parent` above for why. + # /var/lib/gitea-runner-work (rootfs, sibling of the StateDirectory symlink), + # not under /var/lib/private/ which is mode 700 and only traversable by root. systemd.tmpfiles.rules = xlib.helpers.mkTmpDirs { - dir = "/var/lib/gitea-runner/work"; + dir = "/var/lib/gitea-runner-work"; mode = "0755"; user = "gitea-runner"; group = "gitea-runner";