Repository navigation
fix(image): set empty build-users-group in baked nix.conf - #750
Merged
Merged
Conversation
The in-image nix runs as root, single-user, daemonless (no nixbld group), so on-demand 'nix shell'/'nix develop' needing a local build aborted with "the group 'nixbld' does not exist" (e.g. a rust-overlay toolchain). Bake 'build-users-group =' (empty) so root builds directly. Extends #739. Refs: #749
This was referenced Jun 30, 2026
c-vigo
added a commit
that referenced
this pull request
Jun 30, 2026
…onfig (#782) ## Problem `accept-flake-config = true` was baked into the image's `/etc/nix/nix.conf`. That made any in-container `nix run github:attacker/flake` silently accept that flake's `substituters`/`trusted-public-keys` — the textbook Nix cache-redirection supply-chain attack (PR #670 roadmap thread A). ## Fix - **Remove** `accept-flake-config = true` from the baked nix.conf. - **Bake explicit** `substituters` + `trusted-public-keys` so normal builds still hit the caches, while a foreign flake's `nixConfig` now requires a per-invocation `--accept-flake-config`. - Keep `experimental-features` and the empty `build-users-group =` (#750) intact. Keys/URLs are taken verbatim from the repo's existing source of truth, `CONTRIBUTE.md:44-45` (the public `vig-os` Cachix cache + upstream `cache.nixos.org`). These are PUBLIC keys, safe to bake. ### Baked `/etc/nix/nix.conf` — before / after Before: ```conf experimental-features = nix-command flakes accept-flake-config = true build-users-group = ``` After (verified by extracting the built image tarball's bootstrap layer): ```conf experimental-features = nix-command flakes substituters = https://cache.nixos.org https://vig-os.cachix.org trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= vig-os.cachix.org-1:yoOYRi3bvnM6ThxO0joLt7vtzhTfkq3r6jykeUMg7Bk= build-users-group = ``` ### Cachix key source `vig-os.cachix.org-1:yoOYRi3bvnM6ThxO0joLt7vtzhTfkq3r6jykeUMg7Bk=` — `CONTRIBUTE.md:45` (the documented `vig-os` Cachix substituter setup). Not invented. ## Tests Extended `tests/test_image.py::TestNixConfiguration` (alongside the existing #749 `build-users-group` assertions) with three testinfra checks against the baked nix.conf: - `test_nix_conf_does_not_accept_flake_config` — asserts `accept-flake-config = true` is gone. - `test_nix_conf_bakes_explicit_substituters` — asserts both cache URLs present. - `test_nix_conf_bakes_trusted_public_keys` — asserts both public keys present. ## Verification - `nix flake check --accept-flake-config` — all checks passed. - `nix build .#devcontainerImage` — succeeded, substituted from caches (no mass source rebuild); extracted the resulting tarball and confirmed the baked nix.conf matches the "after" block above. - `nixfmt --check flake.nix`, `ruff check/format` on the test, and `pre-commit run --files ...` — all relevant hooks pass. - The image-side testinfra assertions require a running container, so they run in image CI rather than locally. ## Branch note The originally-suggested `security/` branch prefix is rejected by the repo's mandatory `no-commit-to-branch` hook (allowed types: `feature|bugfix|hotfix|release|docs|test|refactor`, plus `chore/` and `worktree/`). A security fix maps to `bugfix`, so this PR is on `bugfix/773-explicit-substituters`. Closes #773.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #749. Extends #739: the baked nix.conf enabled nix-command/flakes but the in-image root/single-user/daemonless nix has no
nixbldgroup, so on-demandnix shell/nix developneeding a local build (not pure cache substitution — e.g. a rust-overlay toolchain) aborted. Addsbuild-users-group =(empty). Verified in-image: a local derivation build now succeeds. Newtest_nix_conf_disables_build_users_groupasserts the setting.