devbox: route root nix through the daemon for R2 cache auth #1018

Closed
JakeHillion wants to merge 1 commits from jj/nmtkozyvvnxq into main
pull from: jj/nmtkozyvvnxq
1 Commits
Author SHA1 Message Date
JakeHillion 0df8677778 devbox: route root nix through the daemon for R2 cache auth
commit-validation / validate-single-commit (pull_request) Successful in 5s
flake / flake (push) Failing after 1m40s
nix-builder (x86_64-linux) Build completed successfully
nix-builder (aarch64-linux) Build completed successfully
Running `sudo nix build` (or `sudo nixos-rebuild`) on devbox hosts spammed
"AWS error fetching <hash>.narinfo: Unable to parse ExceptionName:
InvalidArgument Message: Authorization" for every cache miss against the
testquorum R2 substituter.

The R2 credentials are supplied to nix-daemon via systemd EnvironmentFile,
but with the default `auto` store, nix invoked as root opens LocalStore
directly and bypasses the daemon entirely. Root's process has no AWS env
vars, so unsigned requests to R2 come back as 400 InvalidArgument. Setting
`nix.settings.store = "daemon"` forces every nix CLI invocation, including
root's, to talk to nix-daemon, which already has the credentials it needs.

Test plan:
- CI
- `sudo nix build /nix/store/1rng2bfl68fq38j6wmni65ki6cp2nkfy-mongodb-7.0.26`
  on maverick after switch — no AWS errors
2026-04-09 23:29:25 +01:00