-
Notifications
You must be signed in to change notification settings - Fork 14
Nixos flake #409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Nixos flake #409
Conversation
Namely, - `devx` for console debugging extras used in `tractor.devx`. - `repl` for @goodboy's `xonsh` hackin utils. - `testing` for harness stuffs. - `lint` for whenever we start doing that; it requires special separation on nixos in order to pull `ruff` from pkgs. Oh and bump the lock file.
Based on the impure template from `pyproject.nix` and providing a dev-shell for easy bypass-n-hack on nix(os) using `uv`. Deats, - include bash completion pkgs for devx/happiness. - pull `ruff` from <nixpkgs> to avoid wheel (build) issues. - pin to py313 `cpython` for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds a Nix flake-based dev shell aimed at “impure” uv-managed development, and updates Python dependency grouping/locking to support that workflow.
Changes:
- Introduce
flake.nix/flake.lockto provide anix developdev shell. - Restructure
pyproject.tomldependency groups (split intodevx,testing,repl, addlint). - Regenerate
uv.lockto reflect new groups and addruffto the lock.
Reviewed changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
flake.nix |
Adds a Nix flake dev shell that installs Python/uv tooling and runs uv sync on shell entry. |
flake.lock |
Pins nixpkgs for the new flake-based workflow. |
pyproject.toml |
Refactors dependency groups and introduces a lint group for ruff. |
uv.lock |
Updates lock revision and records new dependency groups + locked ruff artifact set. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # An "impure" template thx to `pyproject.nix`, | ||
| # https://pyproject-nix.github.io/pyproject.nix/templates.html#impure | ||
| # https://github.com/pyproject-nix/pyproject.nix/blob/master/templates/impure/flake.nix | ||
| { | ||
| description = "An impure overlay using `uv` with Nix(OS)"; |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flake’s description (and header comment) calls this an “impure overlay”, but this flake only defines devShells and does not provide an overlay output. Consider rewording to avoid misleading users (e.g., describe it as an impure dev shell).
| # An "impure" template thx to `pyproject.nix`, | |
| # https://pyproject-nix.github.io/pyproject.nix/templates.html#impure | |
| # https://github.com/pyproject-nix/pyproject.nix/blob/master/templates/impure/flake.nix | |
| { | |
| description = "An impure overlay using `uv` with Nix(OS)"; | |
| # An "impure" dev shell template thanks to `pyproject.nix`, | |
| # https://pyproject-nix.github.io/pyproject.nix/templates.html#impure | |
| # https://github.com/pyproject-nix/pyproject.nix/blob/master/templates/impure/flake.nix | |
| { | |
| description = "An impure dev shell using `uv` with Nix(OS)"; |
|
|
||
| # on nixos, use pkg(s) | ||
| ruff | ||
| pypkgs.ruff |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages includes both ruff and pypkgs.ruff. These typically install the same ruff executable, which can lead to PATH ambiguity and unnecessary closure size. Pick one source (either the top-level pkgs.ruff or the Python package) and remove the other.
| pypkgs.ruff |
| packages = with pkgs; [ | ||
| # XXX, ensure sh completions activate! | ||
| bashInteractive | ||
| bash-completion | ||
|
|
||
| # on nixos, use pkg(s) | ||
| ruff | ||
| pypkgs.ruff | ||
|
|
||
| uv | ||
| python313 # ?TODO^ how to set from `cpython` above? |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpython is defined as a single source of truth for the Python version, but packages still hard-codes python313. This makes it easy to accidentally desync the selected interpreter from cpython/venv_dir. Use the cpython variable consistently when selecting the Python derivation.
| packages = with pkgs; [ | |
| # XXX, ensure sh completions activate! | |
| bashInteractive | |
| bash-completion | |
| # on nixos, use pkg(s) | |
| ruff | |
| pypkgs.ruff | |
| uv | |
| python313 # ?TODO^ how to set from `cpython` above? | |
| packages = [ | |
| # XXX, ensure sh completions activate! | |
| pkgs.bashInteractive | |
| pkgs.bash-completion | |
| # on nixos, use pkg(s) | |
| pkgs.ruff | |
| pypkgs.ruff | |
| pkgs.uv | |
| pkgs.${cpython} # selected via `cpython` |
| # - always use the ./py313/ venv-subdir | ||
| # - sync env with all extras | ||
| export UV_PROJECT_ENVIRONMENT=${venv_dir} | ||
| uv sync --dev --all-extras --no-group lint | ||
|
|
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shell hook runs uv sync --dev --all-extras --no-group lint, but lint is not included in the dev dependency-group in pyproject.toml, so --no-group lint is currently redundant. Dropping it avoids confusion and reduces the chance of failures if a user has an older uv that doesn’t recognize that flag.
For those who want to hack on
Nix(OS)using the most modern suggestion for an "impure overlay" frompyproject.nixand usinguv,https://pyproject-nix.github.io/pyproject.nix/templates.html#impure
Try it
nix develop -c uv run pytest testsi personally always use,
nix develop -c uv run xonshto get my preferred user-shell forhackin.