Repository navigation
feat(image): bake /etc/nix/nix.conf enabling nix-command and flakes - #742
Merged
Merged
Conversation
The Nix-built image bundles CppNix but shipped no /etc/nix/nix.conf, so the modern CLI's nix-command/flakes experimental features were disabled by default and ad-hoc on-demand tooling (`nix shell nixpkgs#<x>`, `nix run`, `nix eval`) failed without an explicit `--extra-experimental-features` flag. The buildLayeredImage bootstrap layer now writes /etc/nix/nix.conf with `experimental-features = nix-command flakes` and `accept-flake-config = true` (matching the repo's `nix build --accept-flake-config` posture). Add a TestNixConfiguration suite asserting the file exists, enables both features, and that `nix eval` works without the flag. Flake-registry nixpkgs pinning is deferred (needs the locked input's store path threaded in). Refs: #739
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.
Summary
The Nix-built devcontainer image bundles CppNix but shipped no
/etc/nix/nix.conf, so the modern CLI'snix-command/flakesexperimental features were disabled by default. Ad-hoc on-demand tooling (nix shell nixpkgs#<x>,nix run,nix eval) failed without an explicit--extra-experimental-features "nix-command flakes"flag.Change
flake.nix: thebuildLayeredImagebootstrap layer now writes/etc/nix/nix.confcontaining:accept-flake-configmatches the repo's build posture (CI and docs invokenix build --accept-flake-config).tests/test_image.py: newTestNixConfigurationsuite asserting the file exists, enables both features, and thatnix evalworks without the flag.CHANGELOG.md(+ synced workspace mirror):## Unreleased→### Addedentry.Flake-registry
nixpkgspinning to the image's locked input is deferred: it needs the input's store path threaded into the bootstrap and is not a one-liner, so on-demandnix shelltracks the channel default for now (noted in a code comment).Verification
This environment is offline, so the full image build (which fetches its closure from
cache.nixos.org) could not run locally. Verified instead:nix eval --raw .#devcontainerImage.drvPathsucceeds — the flake change evaluates to a valid derivation.nixfmt --check flake.nixclean; fullpre-commitrun passes..bashrcheredoc; a dedent+heredoc simulation produces a cleannix.confwith no leading whitespace.The CI
imagesuite will perform the real build + in-container assertion thatcat /etc/nix/nix.confandnix eval --expr "1+1"succeed without the experimental-features flag.Closes #739