← Back to list

template-creation
by khaneliman
Nix configuration for my systems supporting macOS, NixOS, and WSL.
⭐ 303🍴 14📅 Jan 23, 2026
SKILL.md
name: template-creation description: Create development environment templates and project scaffolding with Nix flakes. Use when creating new project templates, setting up dev shells, configuring language-specific environments, or integrating with CI/CD.
Template Creation Guide
Expert guidance for creating comprehensive development environment templates with Nix flakes.
Core Principles
- Reproducibility - Same template produces identical environments everywhere
- Developer experience - Fast to use, easy to understand
- Language-specific best practices - Follow conventions for each ecosystem
- Integration-ready - Works with editors, CI/CD, containers
- Maintainability - Easy to update dependencies and configurations
Template Creation Workflow
Copy this checklist when creating templates:
Template Creation Progress:
- [ ] Step 1: Identify target language/framework requirements
- [ ] Step 2: Design flake structure and inputs
- [ ] Step 3: Create devShell with all needed tools
- [ ] Step 4: Add language-specific configuration files
- [ ] Step 5: Configure editor/IDE integration
- [ ] Step 6: Add CI/CD configuration
- [ ] Step 7: Write documentation
- [ ] Step 8: Test on clean system
Flake Template Structure
Basic Template Layout
template/
├── flake.nix # Main flake definition
├── flake.lock # Locked dependencies
├── .envrc # direnv integration
├── .gitignore # Git ignore patterns
├── README.md # Documentation
└── src/ # Source code placeholder
Standard flake.nix Template
{
description = "Project description";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
# Add development tools here
];
shellHook = ''
echo "Development environment loaded"
'';
};
# Optional: packages, apps, etc.
}
);
}
Language-Specific Templates
Node.js/TypeScript
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs_20
nodePackages.npm
nodePackages.typescript
nodePackages.typescript-language-server
];
shellHook = ''
export PATH="$PWD/node_modules/.bin:$PATH"
'';
};
Configuration files to include:
tsconfig.json- TypeScript configurationpackage.json- Package manifest.prettierrc- Code formatting.eslintrc.js- Linting rules
Python
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
python311
python311Packages.pip
python311Packages.virtualenv
python311Packages.black
python311Packages.mypy
pyright
];
shellHook = ''
# Create venv if it doesn't exist
if [ ! -d .venv ]; then
python -m venv .venv
fi
source .venv/bin/activate
'';
};
Configuration files to include:
pyproject.toml- Project configurationrequirements.txtorpoetry.lock- Dependencies.python-version- Python version
Rust
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
rustc
cargo
rust-analyzer
clippy
rustfmt
];
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
Configuration files to include:
Cargo.toml- Package manifestrust-toolchain.toml- Toolchain version.rustfmt.toml- Formatting rules
Go
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
go
gopls
golangci-lint
delve
];
shellHook = ''
export GOPATH="$PWD/.go"
export PATH="$GOPATH/bin:$PATH"
'';
};
Editor Integration
VS Code
.vscode/settings.json:
{
"editor.formatOnSave": true,
"nix.enableLanguageServer": true,
"nix.serverPath": "nil"
}
direnv (.envrc)
use flake
CI/CD Integration
GitHub Actions
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v14
with:
name: your-cache
- run: nix build
- run: nix flake check
Template Quality Checklist
-
nix flake checkpasses - DevShell includes all required tools
- Editor integration configured
- CI/CD workflow included
- README with setup instructions
-
.gitignorecovers generated files - License file included
- Works on Linux and macOS
Common Patterns
Multi-Shell Template
devShells = {
default = pkgs.mkShell {
# Default development environment
};
ci = pkgs.mkShell {
# Minimal CI environment
};
full = pkgs.mkShell {
# Full environment with optional tools
};
};
Cross-Platform Considerations
buildInputs = with pkgs; [
# Common tools
git
jq
] ++ lib.optionals stdenv.isDarwin [
# macOS-specific
darwin.apple_sdk.frameworks.Security
] ++ lib.optionals stdenv.isLinux [
# Linux-specific
inotify-tools
];
See Also
- Flake management: See managing-flakes for input and lock file management
- Writing Nix: See writing-nix for Nix code best practices
- Module scaffolding: See scaffolding-modules for NixOS module templates
Score
Total Score
65/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
✓人気
GitHub Stars 100以上
+5
✓最近の活動
1ヶ月以内に更新
+10
✓フォーク
10回以上フォークされている
+5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
Reviews
💬
Reviews coming soon
