From 18f4639bb75698587d05b84917353669a6d213be Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Sun, 1 Nov 2026 23:24:40 -0500 Subject: [PATCH] bazel-build: clarify what idmap does on the repo cache bind Container root stays an unprivileged host user; idmap only maps file owners on that mount. Add a TODO for sharing the cache without root-owned files. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0119iKoN3fSvRGUAYHupPW4U --- modules/nixos/server/services/ABOUTME.md | 6 ++++-- modules/nixos/server/services/bazel-build.nix | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/nixos/server/services/ABOUTME.md b/modules/nixos/server/services/ABOUTME.md index 9ae4f4b..b836248 100644 --- a/modules/nixos/server/services/ABOUTME.md +++ b/modules/nixos/server/services/ABOUTME.md @@ -49,8 +49,10 @@ services/ - Downloads share one cache per host (`/var/lib/bazel-repo-cache` → `/repo-cache`, sha256-checked, 30-day cleanup). Fetched repo folders stay per container (`--repo_contents_cache`), since their contents are not checked. - - Containers use private user IDs, so writable binds (`/repo-cache`) use - `idmap`; without it the folder shows as `nobody` and the container can't write. + - Container root is an unprivileged host user, so writable binds (`/repo-cache`) + use `idmap`; without it the folder shows as `nobody` and the container can't + write. `idmap` only maps file owners on that mount, so what it writes there is + owned by root on the host. TODO: share the cache without root-owned files. - Global goose hints (`/root/.config/goose/.goosehints` → `/etc/goose/goosehints`): a local build means something is wrong (stop and report); build Go through Bazel. - Exposes `agentSystem` (slackerbot's agent + bazel, go, bazelrc, rbuild) and diff --git a/modules/nixos/server/services/bazel-build.nix b/modules/nixos/server/services/bazel-build.nix index afd7e74..4658afe 100644 --- a/modules/nixos/server/services/bazel-build.nix +++ b/modules/nixos/server/services/bazel-build.nix @@ -4,8 +4,10 @@ # container: bazel build //app ──grpc──▶ NativeLink (host) ──▶ host CPUs # ◀── final outputs downloaded (small, same machine) # -# slackerbot mounts the shared download cache through `binds`. Containers use -# private user IDs, so writable binds need `idmap` (container root = host root). +# slackerbot mounts the shared download cache through `binds`. Container root +# is an unprivileged host user; `idmap` only maps file owners on that mount, so +# what it writes in /repo-cache is owned by root on the host. +# TODO: share the Bazel cache with containers without files owned by root. { config, lib, pkgs, nativelink, slackerbot, ... }: with lib;