A collection of Nix flake templates for quickly bootstrapping development environments.
A comprehensive development environment featuring:
- Nickel: Configuration language for maintainable configs
- Mask: Task runner for automating development workflows
- Treefmt: Multi-language code formatter
- Direnv: Automatic environment loading
- Additional development tools (git, nix-direnv)
Create a new project with the default template:
# Create a new directory and initialize with the template
mkdir my-new-project
cd my-new-project
nix flake init -t github:sstitle/flake-templatesOr initialize in an existing directory:
# In your existing project directory
nix flake init -t github:sstitle/flake-templatesOnce you've initialized a project with the template:
-
Enter the development environment:
nix develop
-
Or use direnv for automatic loading:
direnv allow
-
View available tasks:
mask --help
-
Format your code:
treefmt # or nix fmt
The template includes a comprehensive development shell with:
- Nickel configuration language
- Mask task runner
- Treefmt formatter
- Git and direnv tools
- Helpful shell hook with usage information
- Mask file for convenient scripting
Treefmt configuration supporting multiple languages, add to treefmt.nix to add more languages.
Automatic environment loading with .envrc configuration for seamless development workflow.
To work on these templates:
git clone https://github.com/sstitle/flake-templates
cd flake-templates
nix developTo test a template locally:
# In a temporary directory
mkdir /tmp/test-template
cd /tmp/test-template
nix flake init -t /path/to/flake-templates
nix develop.
├── flake.nix # Main flake with template definitions
├── flake.lock # Lock file with pinned dependencies
├── templates/ # Template definitions
│ └── default/ # Default template files
│ ├── flake.nix # Template flake configuration
│ ├── treefmt.nix # Formatter configuration
│ ├── maskfile.md # Task definitions
│ ├── .envrc # Direnv configuration
│ └── README.md # Template documentation
└── README.md # This file
- Create a new directory under
templates/ - Add your template files
- Update the main
flake.nixto include the new template - Commit your changes
- Test the template
Example:
templates = {
default = { /* existing template */ };
my-new-template = {
path = ./templates/my-new-template;
description = "My custom development environment";
};
};