Skip to content

fix(devshell): expose python3 and pre-commit on dev-shell PATH (#729) - #733

Merged
c-vigo merged 4 commits into
feature/625-nix-claude-migrationfrom
bugfix/729-devshell-parity
Jun 29, 2026
Merged

c-vigo merged 4 commits into
feature/625-nix-claude-migrationfrom
bugfix/729-devshell-parity

Conversation

@c-vigo

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

Copy link
Copy Markdown
Contributor

Summary

Downstream consumers of the toolchain via the flake-input / direnv path (vigos.lib.mkProjectShell, nix develop) got a dev-shell with no bare python / python3 and no pre-commit on PATH, even though the OCI image provides all three. Python was reachable only via uv run python. This is a dev-shell ↔ image parity gap.

Closes #729.

Root cause

  • devTools (the toolchain SSoT) deliberately omits a bare interpreter and pre-commit. The dev-shell pins UV_PYTHON to a Nix-store CPython but puts nothing on PATH.
  • imageTools adds them separately: a pythonEnv (python314.withPackages) and pkgs.pre-commit. So only the image had parity.
  • mkProjectShell (hence devShells.default) built its package set from devTools alone, so the downstream shell lacked both binaries.

Fix

mkProjectShell now appends the pinned store CPython (python314 — the exact interpreter UV_PYTHON already references, reused for DRY) and pkgs.pre-commit to the shell's base packages.

Nuance (intentional, explained in the flake comment): these stay out of the devTools SSoT. The image already provides them via pythonEnv + pre-commit; adding a bare python314 to the SSoT would collide with pythonEnv in dockerTools.buildLayeredImage. The project venv remains uv-managed — exposing python3 on PATH does not change uv resolution (which goes through UV_PYTHON); it just closes the parity gap.

Tests (TDD)

Added test_devshell_exposes_python3_and_precommit (parametrized over python3 and pre-commit) in tests/test_flake_devshell.py. It runs under nix develop --ignore-environment --keep HOME so it asserts the dev-shell's own PATH contribution — a host python3/pre-commit leaking through the inherited environment can no longer mask the gap (which is exactly how it hid). Written failing first, then fixed.

Verification

$ nix develop --ignore-environment --keep HOME . -c bash -c \
    'command -v python3 && python3 --version && command -v pre-commit && pre-commit --version'
/nix/store/...-python3-3.14.4/bin/python3
Python 3.14.4
/nix/store/...-pre-commit-4.5.1/bin/pre-commit
pre-commit 4.5.1
  • pytest tests/test_downstream_flake.py tests/test_flake_devshell.py → 12 passed, 1 skipped
  • nix flake check → all checks passed (format, devShell build, devShellTools eval)

🤖 Generated with Claude Code

c-vigo added 4 commits June 29, 2026 10:17
mkProjectShell carried neither a bare Python interpreter nor pre-commit,
so a downstream flake-input / direnv dev-shell could reach Python only
via `uv run` and had no `pre-commit` at all, breaking parity with the
image (which ships both via pythonEnv + pre-commit in imageTools). Add
the pinned store CPython (python314, reusing the UV_PYTHON binding) and
pkgs.pre-commit to the shell's base packages. They stay out of the
devTools SSoT because the image already provides them and a bare
interpreter there would collide with pythonEnv.

Refs: #729
@c-vigo
c-vigo merged commit a7bda4e into feature/625-nix-claude-migration Jun 29, 2026
@c-vigo
c-vigo deleted the bugfix/729-devshell-parity branch June 29, 2026 08:43
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