Use nix flake to make dev environments reproducible (e.g. tools, environment variables, init scripts).
This repository is heavily inspired by the-nix-way/dev-templates and tailored for personal preferences.
Install Nix and enable the following experimental features:
nix.settings.experimental-features = [ "nix-command" "flakes" ];# To initialize (where `ENV` is listed in the table below):
nix flake init --template github:whisperpine/dev-templates#ENV
# Here's an example (for the rust template):
nix flake init --template github:whisperpine/dev-templates#rust
# To ensure it's up to date, use `--refresh`:
nix flake init --refresh --template github:whisperpine/dev-templates#rustOnce your preferred template has been initialized, you can use the provided shell in two ways:
- If you have nix-direnv installed,
you can initialize the environment by running
direnv allow. - If you don't have nix-direnv installed,
you can run
nix developto enter the nix-defined shell environment.
# list all the templates (notice items under "templates"):
nix flake show github:whisperpine/dev-templates- empty: a good start point for any projects.
- golang: manage golang toolchain with configurable versions.
- python: python virtual environment managed by uv.
Notice the shellHook "source .venv/bin/activate", which is essential. - rust: manage rust toolchain, targets and others tools.
It supersedes the functions ofrustupin a declarative way. - web: web or nodejs dev environment managed by bun.
Notice web/.envrc extendsPATHenvironment variable.