Skip to content

build(devcontainer): install Nix and bake the development shell in - #52

Open
Joibel wants to merge 1 commit into
tb-ufbi.7-pr7from
tb-ufbi.5-pr5
Open

build(devcontainer): install Nix and bake the development shell in#52
Joibel wants to merge 1 commit into
tb-ufbi.7-pr7from
tb-ufbi.5-pr5

Conversation

@Joibel

@Joibel Joibel commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Based on PR #47

Chain of upstream PRs as of 2026-07-30

Fixes #TODO

Motivation

Modifications

Verification

Documentation

AI

🤖 Generated with Claude Code

https://claude.ai/code/session_01H871PuNyYPzjmpUhXCRXGA

@Joibel Joibel self-assigned this Jul 30, 2026
@Joibel
Joibel force-pushed the tb-ufbi.5-pr5 branch 2 times, most recently from 6bd4e33 to e3b0bc9 Compare July 30, 2026 12:30
The dev container described the toolchain a second time: the Go, Node and
Python dev container features, apt's protoc and clang-format, a kubectl
pinned to the minimum tested Kubernetes version, and `make tilt` at create
time. flake.nix already describes all of that. Replace the lot with Nix, and
run `nix develop` during the image build so the store ships warm.

Entering the shell in the container evaluates the same flake.nix, flake.lock
and go.mod the build copied in, so it resolves to a derivation that is
already realised — 2.3s, no downloads, no network. Interactive shells enter
it from .bashrc, and pre-build.sh runs inside it from postCreateCommand;
that script now only creates the cluster, since nothing needs installing.

Nix is installed single-user and owned by `vscode`, because a container has
no init system to run the multi-user daemon under. That also rules out the
build sandbox, hence `sandbox = false`: with the Cachix cache and the warm
store, nothing is expected to build in there anyway.

The guard around the .bashrc line is a variable of our own rather than
IN_NIX_SHELL, which looks like the obvious choice but is not yet exported at
the point `nix develop` sources ~/.bashrc — recursing until the container
runs out of processes.

The Dev Container workflow rebuilds on flake.nix, flake.lock and go.mod
instead of hack/k8s-versions.sh, which the image no longer reads, and sets
Nix up for itself: the `devcontainer` CLI that `make devcontainer-build`
runs now comes from the shell rather than from an npm install target that no
longer exists.

The Nix workflow grows an aarch64-linux job. The dev container image is
built for arm64 as well, and without that half of the cache the QEMU build
compiles every pinned tool from source.

Two things get worse. The image is much bigger — 7.4GB against the 2.5GB it
replaces — because a Nix store holding a whole toolchain costs more than the
distro packages it replaces. And kubectl is nixpkgs' rather than the minimum
tested version, which is what everyone developing outside the container has
been using all along.

Verified by building the image and the dev container CLI's version of it
with the docker-in-docker feature on top: an interactive shell lands in the
development shell with go, tilt, kubectl and make from the store and docker,
git, sudo and curl still on PATH behind them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UfBK3mQcTNEBEGpXu4hzCY
Signed-off-by: Alan Clucas <alan@clucas.org>
@Joibel
Joibel changed the base branch from tb-ufbi.2-pr2 to tb-ufbi.7-pr7 July 31, 2026 11:24
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