Template repository
All templates are now available at: tgirlcloud/nix-templatesUsing templates
There are two ways to use the templates:Initialize in current directory
Initialize a template in the current directory:Create in new directory
Create a new directory with the template:Available templates
To see all available templates:- List templates
- Web view
Common templates
While the exact list may change, typical templates include:Rust
Rust development environment with cargo and rust-analyzer
Python
Python environment with pip, virtualenv, and common tools
Node.js
Node.js/TypeScript setup with npm/pnpm and common tooling
Go
Go development environment with Go toolchain and LSP
Template structure
Templates typically include:flake.nix- Flake configuration with development shellflake.lock- Locked dependency versions.envrc- direnv integration (optional)- Language-specific files (e.g.,
Cargo.toml,package.json)
Example template structure
Using a template
Here’s a complete workflow for starting a new project:Creating your own templates
You can create custom templates in your own repository:Template best practices
Include .envrc for direnv
Include .envrc for direnv
Add direnv support for automatic shell activation:Users with direnv installed will automatically enter the dev shell.
.envrc
Lock dependencies
Lock dependencies
Always include
flake.lock to ensure reproducible builds:Add helpful documentation
Add helpful documentation
Include a README explaining:
- What the template provides
- How to use it
- How to customize it
- Common commands
Keep it minimal
Keep it minimal
Templates should be starting points, not complete applications. Include:
- Essential dependencies
- Basic configuration
- Example files
- Too many opinionated choices
- Complex build setups
- Large dependency trees
Integration with development shells
Templates work great with development shells defined in your system configuration:home/yourname/dev/rust.nix
flake.nix can add project dependencies:
Next steps
nix-templates
Browse available templates
Adding packages
Learn about package management
Development environments
Read about nix develop
Flakes
Learn more about Nix flakes