The dev shells and templates which I'm using across different projects. Gathered here instead of writing the same flake/shell in multiple projects.
To list available shells & templates run:
nix flake show github:onjin/nix-devTo use the shells from remote run:
nix develop "github:onjin/nix-dev#python-312-venv"Python flakes' environment variables:
To pass variables into flake you need to use --impure flag.
NIX_DEV_PYTHON_VENVDIR=~/.local/share/myenv- overwrite./.venvdefault for...-envpython flakesNIX_DEV_PYTHON_REQUIREMENTS_TXT=requirements.txt- runpip install -r ...for file name set as variableNIX_DEV_PYTHON_REQUIREMENTS="uv anyio"- runpip install ...for list of packages
Or clone repository and use from path:
git clone https://github.com/onjin/nix-dev
cd nix-dev
nix develop .#python-312-venvIntegrate with https://direnv.net/:
$ cat .envrc
export NIX_DEV_PYTHON_VENVDIR=~/.local/share/myenv
export NIX_DEV_PYTHON_REQUIREMENTS_TXT=requirements.txt
export NIX_DEV_PYTHON_REQUIREMENTS="uv anyio"
use flake github:onjin/nix-dev#python-313-venv --impureYou can combine multiple environment, i.e. python + nodejs adding two use flake ... lines or running nix flake ... twice. Or more :)
To initialize your project using template run:
nix flake new -t "github:onjin/nix-dev#python-shell" my-python-projectpython:
- python-shell