nix-flake
Use this when writing or editing a flake.nix. Covers flake-parts, perSystem, formatter, shell scripts, and package conventions.
Best use case
nix-flake is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Use this when writing or editing a flake.nix. Covers flake-parts, perSystem, formatter, shell scripts, and package conventions.
Teams using nix-flake should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/nix-flake/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How nix-flake Compares
| Feature / Agent | nix-flake | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Use this when writing or editing a flake.nix. Covers flake-parts, perSystem, formatter, shell scripts, and package conventions.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Nix Flake Development with flake-parts
All flakes use [flake-parts](https://flake.parts) with `perSystem` for per-architecture outputs.
## Formatter
Always set `formatter = pkgs.nixpkgs-fmt`.
## Shell scripts
Use `pkgs.writeShellApplication` (not `writeShellScriptBin`). It enables strict mode and validates `runtimeInputs` at build time. Always add `meta.description`.
## Key conventions
- Keep `flake.nix` minimal — delegate definitions to individual `.nix` files and import them.
- `perSystem` for per-architecture outputs (packages, devShells, checks, formatter).
- `flake` (top-level) for arch-independent outputs (nixosConfigurations, lib, overlays).
- Add `meta.description` to every package or script.
## Language-specific templates
### Haskell
Use [haskell-template](https://github.com/srid/haskell-template). Key inputs: `haskell-flake`, `nixos-unified`, `fourmolu-nix`. The `flake.nix` delegates entirely to `nixos-unified` autowiring, which auto-imports `./nix/modules/flake/*.nix`.
### Rust
Use [rust-nix-template](https://github.com/srid/rust-nix-template). Key inputs: `rust-flake`, `process-compose-flake`. The `flake.nix` auto-imports all files under `./nix/modules/*.nix` using `builtins.readDir`.
### Home Manager, nix-darwin, NixOS
Use [nixos-unified-template](https://github.com/juspay/nixos-unified-template). Key inputs: `home-manager`, `nix-darwin`, `nixos-unified`. Also uses `nixos-unified` autowiring.
## Dev services
- [`process-compose-flake`](https://github.com/Platonic-Systems/process-compose-flake): runs multi-process dev environments (backends, watchers, etc.) via `process-compose` integrated into a `devShell`.
- [`services-flake`](https://github.com/juspay/services-flake): built on top of `process-compose-flake`; provides ready-made service modules (PostgreSQL, Redis, etc.) for use in dev shells.
## Testing pattern
Isolate tests in `test/flake.nix` to avoid polluting parent. No top-level flake needed — test flake can reference parent content directly:
```nix
configDir = builtins.path { path = ./..; name = "config"; };
```
Use `pkgs.testers.nixosTest` for NixOS VM tests.Related Skills
vhs
Techniques for creating deterministic terminal demo screencasts with VHS
programming-essay
Write a programming essay or blog post in the voice of the canon — Spolsky, Yegge, Graham, Mickens, Dijkstra, Brooks, Nystrom, Kleppmann, patio11. Invoke when the user wants to argue an idea about software, architecture, languages, or the craft — not a debugging war story (use debugging-story for that), not a tutorial, not a release note. The audience is working developers worldwide with taste and strong opinions of their own.
nix-typescript
pnpm + Nix build conventions. Covers fetchPnpmDeps hash management and dependency workflow.
nix-rust-leptos
Conventions for building Leptos CSR apps with Nix (crane + Trunk).
nix-justfile
Conventions for writing justfile recipes in Nix-based projects.
nix-health
Use this when diagnosing or fixing a user's Nix installation — checks flakes, version, caches, max-jobs, direnv, rosetta, trusted-users, and shell config
nix-haskell
Use this when working on a Haskell project with Nix. Covers haskell-flake setup, adding/overriding dependencies, package settings, and devShell configuration.
nix-ci
Use this when setting up CI for a GitHub repository — offers GitHub Actions or Vira depending on the project
frontend-design
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.
cargo-watch
Run cargo-watch in the background for continuous clippy feedback during code editing.
Snowflake Automation
Automate Snowflake data warehouse operations -- list databases, schemas, and tables, execute SQL statements, and manage data workflows via the Composio MCP integration.
agent-bom-discover-snowflake
Discover Snowflake Cortex, Snowpark, notebook, Streamlit, MCP, and AI-observability assets from the operator's environment, emit canonical agent-bom inventory JSON, and scan it without giving agent-bom long-lived Snowflake credentials. Use when a user asks to inventory Snowflake AI or Cortex infrastructure as canonical inventory.