/cc-skills-nix:nix-blueprintfrom cc-skills-nix
numtide/blueprint — Nix flake framework that maps a fixed directory structure to flake outputs with zero glue code. Apply when a repo's flake.nix calls `inputs.blueprint { ... }`; when deciding where a package, devshell, host, module, check or template file must live; when a package/devshell/host is missing from `nix flake show` or `nix build` says the attribute doesn't exist; when adding the `prefix` option; when writing packages/<name>/default.nix, devshell.nix or modules/<class>/<name>.nix. Do NOT use for generic Nix flakes without blueprint (hand-written outputs, flake-parts, flake-utils), for nixpkgs contributions, or for NixOS module semantics unrelated to file placement. Prefer nix-project-scaffold for creating a NEW project, nix-treefmt-formatter for formatter.nix internals, and nixos-host-provisioning for adding hosts with disko/facter.
Ships in cc-skills-nix. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Blueprint generates all flake outputs from the directory layout. The structure IS the API: there is no place to "register" an output — you create a file at the right path and the output exists. Source of truth for every mapping below: lib/default.nix in numtide/blueprint.
A blueprint flake.nix is ~10 lines and rarely changes:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
blueprint.url = "github:numtide/blueprint";
blueprint.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs: inputs.blueprint {
inherit inputs;
prefix = "nix"; # optional: load tree from ./nix/ instead of repo root
# systems = [ "x86_64-linux" ]; # default: x86_64-linux, aarch64-linux, x86_64-darwin, aarch64-darwin
# nixpkgs.config.allowUnfree = true; # forces a fresh nixpkgs import per system
# nixpkgs.overlays = [ ... ];
};
}
With prefix = "nix" every path below lives under nix/ (e.g. nix/packages/foo/default.nix); without it, at the repo root. Convention observed in real repos: application/library projects use prefix = "nix" to keep Nix out of the way; NixOS/system config repos skip the prefix since the whole repo is Nix.
| Path (under prefix) | Flake output |
|---|---|
devshell.nix | devShells.<sys>.default |
devshell.toml | devShells.<sys>.default (needs devshell input) |
devshells/<name>.nix or devshells/<name>/default.nix | devShells.<sys>.<name> |
devshells/<name>.toml | devShells.<sys>.<name> (needs devshell input) |
package.nix | packages.<sys>.default |
packages/<name>.nix or packages/<name>/default.nix | packages.<sys>.<name> + checks.<sys>.pkgs-<name> |
formatter.nix | formatter.<sys> (also registered as packages.<sys>.formatter) |
checks/<name>.nix or checks/<name>/default.nix | checks.<sys>.<name> (overrides auto-generated ones) |
lib/default.nix | lib (and lib.tests runs under checks.<sys>.lib-tests via nix-unit) |
hosts/<host>/configuration.nix | nixosConfigurations.<host> + checks.<sys>.nixos-<host> |
hosts/<host>/darwin-configuration.nix | darwinConfigurations.<host> (needs nix-darwin input) |
hosts/<host>/system-configuration.nix | systemConfigs.<host> (needs system-manager input) |
hosts/<host>/rpi-configuration.nix | nixosConfigurations.<host> (needs nixos-raspberrypi input) |
hosts/<host>/default.nix | escape hatch; returns { class, value }, takes precedence over the others |
hosts/<host>/users/<user>.nix or <user>/home-configuration.nix | home-manager user on that host + standalone legacyPackages.<sys>.homeConfigurations."<user>@<host>" (needs home-manager input) |
modules/nixos/<name>(.nix) | nixosModules.<name> (same for darwin→darwinModules, home→homeModules; any other <class> under modules.<class>.<name>) |
templates/<name>/ | templates.<name> |
No formatter.nix → formatter defaults to pkgs.nixfmt-tree. Full detail (arguments, precedence rules, auto-check naming, home-manager defaults): references/directory-map.md.
Per-system files (packages/, devshells/, checks/, devshell.nix, formatter.nix, package.nix) are loaded with callPackage over a scope containing exactly: inputs, flake (= inputs.self), pkgs, system, perSystem, pname. Declare only what you use — asking for anything else (e.g. stdenv, lib, self) fails with Function called without required argument. Take stdenv etc. through pkgs., or write a nixpkgs-style file and load it with pkgs.callPackage (see the two-file pattern below).
perSystem.<input>.<pkg> is shorthand for inputs.<input>.packages.<sys>.<pkg> (with legacyPackages merged in). perSystem.self.<pkg> refers to this flake's own packages — the way one package or devshell consumes another.
Host and module files are NixOS/darwin/home-manager modules with extra specialArgs inputs, flake, hostName, plus perSystem as a module arg. self was renamed: using self in these throws "self was renamed to flake".
packages/<name>/default.nix is a one-line shim bridging blueprint's scope to nixpkgs' callPackage; package.nix next to it is a normal nixpkgs-style derivation (so stdenv, lib, buildGoModule, etc. inject normally and the file is upstreamable):
# packages/cfleet/default.nix
{ flake, pkgs, ... }:
pkgs.callPackage ./package.nix { src = flake; }
Ecosystem variants swap the scope: pkgs.python313Packages.callPackage ./package.nix { src = flake; }. Cross-package deps pass through the shim: pkgs.callPackage ./package.nix { other = perSystem.self.other; }.
More patterns (treefmt formatter with working format check, devshell with perSystem.self.formatter, host escape hatch wiring disko/nixos-hardware/sops, shared modules imported as flake.modules.nixos.*): references/patterns.md.
nix flake show # full output tree
nix eval .#packages.x86_64-linux --apply builtins.attrNames # names only, no building
nix eval .#checks.x86_64-linux --apply builtins.attrNames
nix eval .#nixosConfigurations --apply builtins.attrNames
nix build .#<name> / nix develop .#<name> / nix fmt / nix flake check
git added → output silently missing. In a git repo, flake evaluation only sees tracked files. A brand-new packages/foo/ simply doesn't appear in nix flake show — no error, no warning. git add the files (staging is enough) and re-run. This is the #1 blueprint time-sink.meta.platforms silently filters packages out of packages.<sys> and checks.<sys> for systems not listed.<name>.nix beats <name>/ when both exist in the same folder — the directory is silently ignored.devshells/<name>/ without default.nix is silently skipped; likewise users/<user>/ without home-configuration.nix, non-.nix files in packages//modules/<class>/, and loose .nix files directly under hosts/.hosts/<name>/ dir with no recognized configuration file throws host '<name>' does not have a configuration and breaks evaluation of all host outputs.passthru.tests, not meta.tests. A package's tests appear as checks.<sys>.pkgs-<name>-<test> only from passthru.tests; putting them under meta.tests silently registers nothing.devshell; hosts/*/users/ → home-manager; darwin/system-manager/rpi hosts → their inputs. Missing ones throw a clear message naming the input to add.pkgs/ is the old name — emits trace: blueprint: the /pkgs folder is now /packages and is otherwise ignored.Details, exact error messages and diagnosis commands: references/failure-modes.md.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub aldoborrero/skills --plugin cc-skills-nix6 skills in this plugin
/nix-oci-imageBuilding and publishing OCI/Docker container images from Nix — dockerTools.buildLayeredImage over a buildEnv (app + cacert), non-root numeric User for Kubernetes runAsNonRoot, version-derived tags, and pushing with skopeo (docker-archive → OCI) to registries like Zot that reject `docker push`. Apply when adding a container image output to a flake; when writing packages/docker/*.nix or dockerTools code; when a Nix-built image fails TLS (missing CA bundle), lacks PATH, or runs as root; when pushing ./result to a private/homelab registry fails; when wiring an image build+push recipe into a justfile or CI. Do NOT use for Dockerfile-based builds, docker-compose, or Kubernetes manifest authoring./nixos-host-provisioningAdding or provisioning a NixOS host in a blueprint-based config flake — hosts/<name>/default.nix escape hatch wiring input modules (disko, sops-nix, nixos-hardware, nixos-facter), declarative partitioning with disko (GPT ESP+root, ext4 or btrfs subvolumes), hardware detection via nixos-facter instead of hardware-configuration.nix, and manual home-manager user wiring. Apply when adding a new machine to a NixOS flake; when writing or editing hosts/<name>/{default.nix,configuration.nix,disko.nix}; when generating or overriding facter.json; when a host needs modules from flake inputs; when home-manager users don't get created on a host. Do NOT use for non-NixOS projects, for nix-darwin-only hosts, or for flakes not using blueprint's hosts/ convention./nix-project-scaffoldHouse-style scaffold for new Nix-flake projects (Go, Python, or other languages) — numtide/blueprint with prefix="nix", direnv .envrc, numtide devshell with in-repo toolchain caches, treefmt formatter, two-file package (default.nix shim + nixpkgs-style package.nix with src=flake), justfile facade, and GitHub Actions CI pinned to flake.lock's nixpkgs. Apply when creating a new project or repository that should use Nix; when adding Nix/flake tooling to an existing Go or Python repo; when asked for a devshell + formatter + CI setup 'like my other repos'; when wiring justfile targets to nix commands; when setting up direnv for a flake. Do NOT use for repos that already follow a different flake convention (flake-parts, devenv, hand-rolled outputs), for NixOS system configuration repos, or for nixpkgs contributions./nix-sops-secretsSecrets in NixOS flakes with sops-nix + age (+ age-plugin-yubikey) — .sops.yaml recipients and creation_rules, a centralized sops.secrets declaration module, and runtime consumption from /run/secrets. Apply when adding, editing or rotating an encrypted secret; when adding a recipient (new host key or YubiKey) or a new host that must decrypt; when a service or user can't read a secret (permission denied, file missing, empty env var); when wiring an API key or password into a NixOS service, home-manager tool or wrapper script; when configuring .sops.yaml, sops.defaultSopsFile or the age host key. Do NOT use for agenix or vault-based setups, for git-crypt, or for generic sops usage outside Nix./nix-treefmt-formattertreefmt-nix formatter for Nix flakes — `formatter.nix` via `treefmt-nix.lib.evalModule` (build.wrapper + build.check), lint→format ordering with priorities (deadnix→nixfmt, shellcheck→shfmt, ruff-check→ruff-format), and the format check wired into `nix flake check` via passthru.tests. Apply when writing or editing formatter.nix / treefmt config in a flake; when adding a language formatter (Go, Python, shell, YAML, TOML, Markdown, just); when `nix fmt` misbehaves, formats vendored files, or skips files (excludes, on-unmatched, default excludes); when CI passes `nix flake check` but formatting is actually broken (check never ran); when deadnix deletes wanted lambda args. Do NOT use for non-treefmt formatting setups, editor/IDE format-on-save config, or choosing code style rules of a language.