Skip to content

feat(image): bake /etc/nix/nix.conf enabling nix-command and flakes - #742

Merged
c-vigo merged 2 commits into
feature/625-nix-claude-migrationfrom
feature/739-nix-conf
Jun 29, 2026
Merged

c-vigo merged 2 commits into
feature/625-nix-claude-migrationfrom
feature/739-nix-conf

Conversation

@c-vigo

@c-vigo c-vigo commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

The Nix-built devcontainer image bundles CppNix but shipped no /etc/nix/nix.conf, so the modern CLI's nix-command/flakes experimental 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: the buildLayeredImage bootstrap layer now writes /etc/nix/nix.conf containing:
    experimental-features = nix-command flakes
    accept-flake-config = true
    
    accept-flake-config matches the repo's build posture (CI and docs invoke nix build --accept-flake-config).
  • tests/test_image.py: new TestNixConfiguration suite asserting the file exists, enables both features, and that nix eval works without the flag.
  • CHANGELOG.md (+ synced workspace mirror): ## Unreleased → ### Added entry.

Flake-registry nixpkgs pinning 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-demand nix shell tracks 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.drvPath succeeds — the flake change evaluates to a valid derivation.
  • nixfmt --check flake.nix clean; full pre-commit run passes.
  • The heredoc indentation (20 spaces) matches the existing proven .bashrc heredoc; a dedent+heredoc simulation produces a clean nix.conf with no leading whitespace.
  • New tests collect cleanly.

The CI image suite will perform the real build + in-container assertion that cat /etc/nix/nix.conf and nix eval --expr "1+1" succeed without the experimental-features flag.

Closes #739

c-vigo added 2 commits June 29, 2026 12:39
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
@c-vigo
c-vigo merged commit d3e487e into feature/625-nix-claude-migration Jun 29, 2026
10 checks passed
@c-vigo
c-vigo deleted the feature/739-nix-conf branch June 29, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant