chore: add GitHub Codespaces devcontainer with Nix and direnv#12
Merged
Conversation
Add devcontainer for GitHub Codespaces with Ubuntu base image and Nix with flakes enabled for reproducible development environments. Tried approaches: - nixpkgs/devbox features: too limited for flake-based workflows - apt-based direnv install: replaced by nix profile in next step
…settings Setup direnv with nix-direnv for cached flake loading, pre-warm the Nix environment during container creation, and configure VS Code with nix-ide, Python, and Ruff extensions. Tried approaches: - direnv VS Code extension (mkhl.direnv): caused reload prompt on startup, removed in favor of bash hook + explicit interpreter path - postAttachCommand for shell info: caused duplicate output, removed - dev server as VS Code task: added then removed, not needed in current workflow - manual direnv allow flow: replaced with auto-allow for better DX
Allow .vscode/settings.json and tasks.json to be tracked in git so Codespaces picks up shared editor configuration. Enable automatic VS Code tasks without the approval prompt.
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
Add a fully configured GitHub Codespaces devcontainer so that new (and existing) contributors can spin up a ready-to-code environment in one click — no local Nix install, no manual direnv setup, no "works on my machine" issues.
Why this matters for developer experience & onboarding
Our project relies on Nix flakes and direnv for reproducible tooling, which can lead to some onboarding effort. With this devcontainer, a new contributor can open the repo in GitHub Codespaces (or any devcontainer-compatible tool) and get:
cd).venvZero manual setup. Open the codespace, wait for the build, start coding.
Changes
.devcontainer/devcontainer.json— New devcontainer config with Ubuntu base, Nix feature, direnv setup viaonCreateCommand, VS Code extensions/settings, and environment variables.gitignore— Allow tracking.vscode/settings.jsonand.vscode/tasks.jsonfor shared editor config.vscode/settings.json— Enable automatic VS Code tasks without promptApproaches tried and rejected
During development, several alternatives were explored:
mkhl.direnv)direnv allowflow