Skip to content

Level-3 uv2nix flake template: Nix is the gate, uv owns the expression - #1

Merged
eli-hedronite merged 2 commits into
mainfrom
cursor/python-gate-flake-template-5a3f
Aug 31, 2026
Merged

eli-hedronite merged 2 commits into
mainfrom
cursor/python-gate-flake-template-5a3f

Conversation

@NebuHedron

@NebuHedron NebuHedron commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Turn this repo from a README stub into a public, reusable Nix flake template for any Python shop.

Model: mkVirtualEnv / withPackages builds a world; mkApplication / wrapProgram locks the door; nix-ld is the FHS lie (unsafe, Level 2). This template is Level 3.

A non-NixOS developer still uv syncs from uv.lock. A Nix user or CI nix develops and nix run .#s the same closure. Two proofs: uv.lock (packages) and flake.lock (builders). A lockfile is not a closure.

What's in the PR

  • flake.nix — uv2nix + pyproject.nix + pyproject-build-systems; same Python set for devShells.default and packages.default; peace treaty (UV_NO_SYNC, UV_PYTHON, UV_PYTHON_DOWNLOADS=never, unset PYTHONPATH)
  • templates.default so nix flake new -t github:Hedronite/python-gate works
  • Tiny src/python_gate console script + rich; nix run .# is network-free (versions + square(12))
  • README rewrite (GitHub template, ladder 0–4, init, must-nots, agent grading) and short docs/theses.md
  • .gitignore (.venv, result, __pycache__, direnv)
  • Both lockfiles committed
  • GitHub Actions: Determinate Nix (nix build / nix run) and uv sync --locked

Systems: x86_64-linux, aarch64-linux, aarch64-darwin. nixos-unstable 26.11 dropped Intel Macs.

MIT copyright Hedronite 2026 is unchanged.

After merge, mark the GitHub repo as a template repository so Use this template works alongside the flake template.

Verified locally

  • nix flake show lists packages.x86_64-linux.default, devShells.x86_64-linux.default, templates.default
  • nix build + nix run .# prints the closed-world table (no network)
  • nix develop --command python -c "import python_gate, rich" — peace treaty holds
  • uv sync --locked
  • nix flake check (including templates.default.isValidTemplate)
  • nix flake new -t path:. copies the template

Agent grading

  1. nix flake show lists default package, devShell, and template
  2. Import inside the declared env
  3. uv sync --locked
  4. nix run uses the same Python set as nix develop
Open in Web Open in Cursor 

cursoragent and others added 2 commits August 31, 2026 16:22
Turn the README stub into a cloneable Nix flake template: uv owns
pyproject.toml/uv.lock, uv2nix builds the same Python set for
nix develop and nix run, and mkApplication ships the product.

Co-authored-by: NebuHedron <NebuHedron@users.noreply.github.com>
Keep linux + aarch64-darwin. CI flake show evaluates the host system only.

Co-authored-by: NebuHedron <NebuHedron@users.noreply.github.com>
@NebuHedron
NebuHedron marked this pull request as ready for review August 31, 2026 16:26
@eli-hedronite
eli-hedronite merged commit 56b7054 into main Aug 31, 2026
2 checks passed
@eli-hedronite
eli-hedronite deleted the cursor/python-gate-flake-template-5a3f branch August 31, 2026 16:28
VirtualMachinist added a commit that referenced this pull request Sep 13, 2026
…e-5a3f

Level-3 uv2nix flake template: Nix is the gate, uv owns the expression
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.

3 participants