Development Philosophy
We follow:- Trunk-Based Development: Short-lived branches merged frequently to
main - Issue-First Policy: Every change maps to a GitHub issue
- Conventional Commits: Standardized commit messages
- Automated Validation: Pre-commit hooks and flake checks
Getting Started
Enter Development Environment
- Pre-commit hooks
- Development tools
- Secret management (agenix-shell)
Contribution Workflow
Create an Issue
Every change must map to a GitHub issue for project tracking.Bug Report Example:Feature Request Example:
Create Feature Branch
Create a short-lived branch from Branch Naming Examples:
main:dev-fix-zsh-typodev-add-k8s-clusterdev-update-nvidia-drivers
Make Changes
Follow the appropriate guide for your change:
Validate Changes
Before committing, ensure everything compiles:Pre-commit hooks will automatically run this, but manual validation catches issues early.
Pre-commit hooks are configured via
git-hooks.nix in the flake and run automatically on commit.Commit with Conventional Commits
Push and Create PR
- Reference the issue number
- Describe what changed and why
- Include testing steps if applicable
Commit Types
Use these conventional commit types:| Type | Description | Example |
|---|---|---|
feat: | A new feature | feat: add sunshine module for gaming VM |
fix: | A bug fix | fix: resolve zsh startup error |
docs: | Documentation only changes | docs: update installation instructions |
style: | Code style changes (formatting, whitespace) | style: format bluetooth module with treefmt |
refactor: | Code change that neither fixes a bug nor adds a feature | refactor: simplify secret management logic |
perf: | Performance improvements | perf: optimize flake evaluation time |
test: | Adding or correcting tests | test: add unit tests for networking module |
chore: | Build process or tooling changes | chore: update flake inputs |
Commit Message Examples
Good:Validation and Testing
Pre-commit Hooks
Automatically run on every commit:- Formatting checks (treefmt)
- Flake validation
- Nix syntax checking
pre-commit.nix:
Manual Validation
Testing Changes
Test on Local System
Test on Local System
Deploy to your test system:
Test in VM
Test in VM
Build and test in a virtual machine:
Test Module in Isolation
Test Module in Isolation
Create a minimal test configuration:
test.nix
Code Style Guidelines
Nix Code
- Use 2 spaces for indentation
- Format with
treefmt(alejandra formatter) - Use
let ... infor computed values - Keep lines under 100 characters where reasonable
- Use descriptive variable names
Module Structure
File Organization
- Group related modules in directories
- Use
default.nixto expose module imports - Keep files focused on a single concern
- Place shared utilities in
lib/
Project Structure
Using Templates
Scaffold new projects or components:empty template includes:
- Basic flake structure
- Pre-commit hooks
- Secret management (agenix)
- Development shell
- Testing framework (nixtest)
Common Tasks
Update Flake Inputs
Update Flake Inputs
Add New Module
Add New Module
- Create issue
- Create branch:
dev-add-<module>-module - Write module in appropriate directory
- Add to
default.niximports - Test with
nix flake check - Commit:
feat: add <module> module
Fix a Bug
Fix a Bug
- Create issue describing bug
- Create branch:
dev-fix-<bug> - Make fix
- Test thoroughly
- Commit:
fix: <description> - Reference issue in PR
Update Documentation
Update Documentation
Troubleshooting
Flake Check Fails
Pre-commit Hook Failures
Build Errors
Getting Help
- Check existing issues for similar problems
- Review documentation and guides
- Ask questions in discussions
- Reference NixOS documentation: https://nixos.org/manual/