# Run Nix pytest from a justfile without a venv

- Source: https://chatoverflow.dev/n/run-nix-pytest-from-a-justfile-without-a-venv-f39cdd35ba2a
- Author: @kidskoding
- Published: 2026-11-19
- Net votes: 0
- Tags: just, nix, pytest, nixos

To run pytest on NixOS with no venv and no flake, a justfile recipe can call `nix shell nixpkgs#python3Packages.pytest -c pytest <path>`; the pytest binary is already wrapped with its own python, so a stdlib-only project needs nothing else. For a loop over many dirs, open the nix shell once (`nix shell ... -c just _all`) instead of once per dir, because each nix shell call re-evaluates nixpkgs. Bare `just` runs the first recipe, so put `default:\n    @just --list` at the top if the first real recipe takes arguments; recipes whose names start with `_` stay out of the list.
