agentleFS
DROOdotFOODROOdotFOO/agent-skills/skills/nix/SKILL.md

nix

Skill1 starsChanged 3 months agoMITView on GitHub

Nix language, flakes, NixOS, Home Manager, and agent-skills packaging. TRIGGER when: working with .nix files, flake.nix, flake.lock, Nargo.toml (Nix packaging context), NixOS configuration, Home Manager modules, nix-agent MCP tools, agent-skills-nix deployment, or rigup.nix riglets. DO NOT TRIGGER when: only using nix PATH (chezmoi handles that), or working on ZK circuits (use noir skill), or Nix language is incidental to another domain.

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

nix

Practical patterns for the Nix ecosystem: the language itself, flake architecture, NixOS/Home Manager configuration, package building, and the emerging pattern of packaging AI agent skills as Nix derivations.

What You Get

  • Nix language idioms (let/with/inherit, builtins, lazy evaluation)
  • Flake architecture (inputs, outputs, lockfiles, overlays)
  • NixOS and Home Manager module patterns
  • Package builders (mkDerivation, buildGoModule, buildNpmPackage)
  • Agent-skills-as-Nix-packages patterns (rigup, nix-agent MCP)

When to use

  • Writing or reviewing .nix files (flakes, modules, overlays, packages)
  • Configuring NixOS or Home Manager
  • Building Nix packages (mkDerivation, buildGoModule, buildNpmPackage, etc.)
  • Managing Nix profiles and registries
  • Packaging agent skills for Nix-based deployment (agent-skills-nix, rigup)
  • Using nix-agent MCP tools for NixOS automation

When NOT to use

  • Nix PATH setup in chezmoi -- handled by paths.zsh.tmpl and chezmoi.toml
  • ZK circuit design -- use noir skill
  • Solidity or Ethereum -- use solidity-auditor or ethskills

Reading guide

Working onRead
Nix language idioms, builtins, let/with/inheritreferences/language
Flake structure, inputs, outputs, lockfilesreferences/flakes
NixOS modules, options, servicesreferences/nixos
Home Manager config, programs, activationreferences/home-manager
Building packages (mkDerivation, language builders)references/packaging
Nix profiles, registries, nix-env alternativesreferences/profiles
Agent skills as Nix packages (agent-skills-nix, rigup, nix-agent MCP)references/agent-integration

Key principles

  1. Reproducibility first -- pin inputs, use flake.lock, avoid impure operations
  2. Composition over mutation -- overlay and override, never patch in place
  3. Lazy evaluation -- Nix is lazy; structure code to exploit this
  4. Declarative over imperative -- describe the target state, not the steps
  5. Module system is the API -- options with types, defaults, and docs

Common pitfalls

MistakeFix
Using rec { } when let ... in worksrec pollutes scope and causes infinite recursion -- prefer let
with pkgs; at module levelShadows names silently -- use pkgs.foo or selective inherit
Forgetting meta.mainProgramBreaks nix run -- always set it for packages with binaries
builtins.fetchurl in flakesImpure -- use flake inputs or fetchurl from nixpkgs
Mutable channel referencesPin nixpkgs as a flake input, not <nixpkgs>
nix-env -i for system packagesUse environment.systemPackages or home.packages
Testing with nix-build when flakeUse nix build .#package -- nix-build ignores flake.nix

See also

  • droo-stack -- shell patterns for nix-related scripts
  • chezmoi templates in droo-stack -- paths.zsh.tmpl nix conditionals

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.