Skip to content

chore: add GitHub Codespaces devcontainer with Nix and direnv#12

Merged
jcardozo-eth merged 3 commits into
mainfrom
chore/codespaces-devcontainer
Feb 11, 2026
Merged

chore: add GitHub Codespaces devcontainer with Nix and direnv#12
jcardozo-eth merged 3 commits into
mainfrom
chore/codespaces-devcontainer

Conversation

@jcardozo-eth

@jcardozo-eth jcardozo-eth commented Feb 11, 2026

Copy link
Copy Markdown
Member

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:

  • Nix with flakes pre-installed and configured
  • direnv + nix-direnv hooked into the shell with flake caching for fast reloads
  • Environment pre-warmed during container creation (no waiting on first cd)
  • VS Code extensions (nix-ide, Python, Ruff) auto-installed
  • Python interpreter correctly pointed at the flake-managed .venv

Zero 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 via onCreateCommand, VS Code extensions/settings, and environment variables
  • .gitignore — Allow tracking .vscode/settings.json and .vscode/tasks.json for shared editor config
  • .vscode/settings.json — Enable automatic VS Code tasks without prompt

Approaches tried and rejected

During development, several alternatives were explored:

Approach Why rejected
direnv VS Code extension (mkhl.direnv) Caused a reload prompt on every codespace startup
Dev server as VS Code task Not needed in current workflow
Manual direnv allow flow Worse DX; auto-allow is safe in a container context

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.
@jcardozo-eth jcardozo-eth changed the title feat: add GitHub Codespaces devcontainer with Nix and direnv chore: add GitHub Codespaces devcontainer with Nix and direnv Feb 11, 2026
@jcardozo-eth jcardozo-eth merged commit b1f31e3 into main Feb 11, 2026
5 of 6 checks passed
@jcardozo-eth jcardozo-eth self-assigned this Feb 17, 2026
@jcardozo-eth jcardozo-eth deleted the chore/codespaces-devcontainer branch February 19, 2026 01:30
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