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
Owner

Running sudo nix build (or sudo nixos-rebuild) on devbox hosts spammed
"AWS error fetching .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
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
JakeHillion added 1 commit 2026-04-09 23:29:51 +01:00
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
0df8677778
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
Author
Owner

This does not work.

This does not work.
JakeHillion closed this pull request 2026-04-09 23:51:59 +01:00

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: JakeHillion/nixos#1018