Nix Knowledge Patch

VerifiedSafe

Use this skill when changing Nix expressions, CLI automation, flakes, stores, NixOS modules, Nixpkgs packages, or Home Manager configurations.

Sby Skills Guide Bot
DevOpsAdvanced
8/26/2026
Claude CodeCursorWindsurfCodex
#nix#nixos#nixpkgs#flakes#migrations

Recommended for

Automated summary

This skill provides a reference index of recent breaking changes across Nix, NixOS, Nixpkgs and Home Manager, with compatibility gates keyed on state versions and flake revisions.

Strengths

  • Forces checking `nix --version`, `system.stateVersion` and `home.stateVersion` before editing, which prevents accidental migrations
  • Organises references by domain: CLI/evaluation, flakes, stores and caches, native APIs, NixOS modules, Nixpkgs packaging and Home Manager
  • Targets concrete migrations: systemd in initrd, free-form options replaced by typed `settings` attributes, moving to `cargoHash`/`buildGoModule`
  • Reminds you to consume explicit JSON output instead of human-readable text when automating in CI

Limitations

  • The file is only an index: the detailed content lives in the linked reference files, which are not included in this SKILL.md
  • Assumes prior familiarity with Nix and flakes; it is not a tutorial for newcomers
  • Reflects a point-in-time snapshot of the ecosystem and may lag behind very recent Nixpkgs changes
When to use it

Use it when editing a Nix expression, flake, NixOS module, Nixpkgs package or Home Manager configuration and you need to know which defaults and migrations apply.

When not to use it

Avoid it when learning Nix from scratch or when writing application code unrelated to the Nix ecosystem.

Security analysis

Safe
Quality score80/100

This is purely a documentation/reference skill for Nix with no declared tools and no executable payloads. The shell snippets shown (nix profile add, nix copy, nix eval, nix path-info) are benign, standard read/build commands with no destructive operations, no curl|sh piping, no secret exfiltration, and no attempts to disable safety controls. It actively advises keeping secrets out of the Nix store and verifying backups/rollback before activation, which is good practice.

No concerns found

How this analysis is made

Examples

Fix a package after a nixpkgs bump
I bumped the nixpkgs input in my flake.lock and my Go package using buildGoModule now fails. Check my system.stateVersion and pinned revision, then update the derivation to current builder conventions.
Migrate NixOS modules to typed settings
My NixOS config sets the Postfix config as a free-form string and uses flat systemd options. Migrate them to the current typed `settings` attributes, removing the old options, without raising system.stateVersion.
Parse Nix output safely in CI
Write a CI script that uses `nix path-info --json` with an explicit JSON schema to check store closure sizes, rather than parsing the human-readable output.

name: nix-knowledge-patch description: Nix version: null license: MIT metadata: author: Nevaberry

Nix Knowledge Patch

Use this skill when changing Nix expressions, Nix CLI automation, flakes, stores, binary caches, NixOS modules, Nixpkgs packages, or Home Manager configurations. Check the project and host versions first, because several defaults and migrations are gated by system.stateVersion or home.stateVersion.

Reference index

| Reference | Topics | | --- | --- | | Core CLI, Evaluation, and Configuration | CLI behavior, evaluator rules, configuration, profiles, REPL, JSON formats, installers, and build execution | | Flakes and Fetchers | Inputs, lock files, Git features, registries, prefetching, archives, and flake checks | | Stores, Caches, and Remote Builds | GC roots, daemon stores, substituters, SSH, S3, HTTP, signing, retries, hooks, and build traces | | Native APIs and Source Builds | C and C++ API migrations, headers, plugins, and the Nix source build system | | NixOS System and Service Migrations | Rebuilds, boot, networking, storage, security, and service-module migrations | | Nixpkgs Packaging | Builder migrations, language ecosystems, hooks, library APIs, platforms, and package scopes | | Home Manager | Activation, profile ownership, state-gated defaults, module renames, XDG paths, and application configuration |

Start with compatibility gates

Before editing:

  1. Read nix --version and the pinned Nixpkgs or flake lock revision.
  2. Read system.stateVersion and home.stateVersion; do not raise either as a general upgrade step.
  3. Identify experimental features used by the configuration.
  4. Check whether automation consumes unstable JSON or human-readable output.
  5. For remote stores, inspect the exact store URI, authentication provider, signing configuration, and underlying cache ordering.
  6. For NixOS switches, inspect boot, initrd, storage, database, and secret migrations before activation.

Highest-impact breaking changes

Treat state versions as migration switches

New defaults for databases, Home Manager paths and formats, service data, and other modules can be state-version gated. Preserve existing state versions unless the operator deliberately performs every associated migration. A package-channel update and a state-version change are separate operations.

Use structured settings and current option names

Many NixOS and Home Manager modules replaced free-form configuration strings, flat options, or renamed modules with typed settings attributes. Remove old options rather than setting both old and new forms. Pay special attention to systemd manager, coredump, sleep, SSH, Postfix, rsyncd, Yggdrasil, firewall, and application-service modules.

Expect systemd in the initrd

Current NixOS uses systemd stage 1 by default. Use stable device paths for the root filesystem and LUKS mapping, review LVM-on-LUKS timeouts, and keep the scripted initrd only as a temporary compatibility measure.

Update packaging builders and hashes

Out-of-tree packages commonly need these migrations:

  • Rust packages use cargoHash and the stable vendoring path.
  • Go packages use buildGoModule; put CGO_ENABLED in env.
  • Python packages declare a modern build format and build system.
  • Node and Yarn packages use current top-level helpers and hooks.
  • pnpm packages use top-level dependency fetchers and regenerate current hashes.
  • buildEnv and derivations that need structured behavior use structured attributes.

Parse machine output by explicit schema

Pass an explicit JSON format to commands that offer one. Derivation JSON, path-info JSON, content addresses, signatures, store paths, and build traces have all gained structured or versioned representations. Never parse human-readable sizes as fixed MiB values, and do not assume terminal JSON is single-line.

Audit service data and secrets before switching

Database major versions, Nextcloud stepping, Immich vector extensions, TaskChampion and Stalwart directories, OAuth2 Proxy secrets, Grafana keys, Yggdrasil private keys, ACME dependencies, and PostgreSQL readiness semantics can require operator action. Keep secret values out of the Nix store and verify backup and rollback procedures first.

Common Nix CLI patterns

Profiles and copied paths

Use nix profile add for profile additions. When copying a path that must survive concurrent garbage collection, create its profile or output-link root as part of the copy operation.

nix profile add nixpkgs#hello
nix copy --from ssh://builder --out-link ./result "$path"

Stable JSON in automation

Force formatting behavior when terminal detection could vary, and select the document schema for versioned commands.

nix eval --json --no-pretty --expr '{ answer = 42; }'
nix path-info --json --json-format 3 "$path"

Evaluation diagnostics

Use stack sampling for performance investigations, IFD tracing for migration work, and JSON log mirroring for structured observability. Short and absolute path-literal checks are tri-state lints; choose warn during migration and fatal only after cleanup.

trace-import-from-derivation = true
lint-short-path-literals = warn
lint-absolute-path-literals = warn

Flake fetching

Declare submodule and LFS requirements on the flake where possible. Relative path inputs affect lock-file compatibility. Use parallel input prefetching when fetching unused inputs is acceptable, and use output links when a prefetched or checked result must be retained.

Store and cache safety

Configure complete substituter chains

An overlay cache must be listed with the cache that supplies its referenced closure. Incomplete substituted closures are no longer filled by mixing a partial substitution with local builds.

Make remote behavior explicit

SSH store URLs may include ports and bracketed IPv6 addresses; percent-encode IPv6 zone separators. Shell-style NIX_SSHOPTS parsing supports quoted proxy commands. For HTTPS or S3 stores, configure authentication, retry policy, compression, addressing style, and metadata lifetime deliberately.

Write concurrent-safe hooks

Post-build hooks may overlap up to max-jobs; dependent builds still wait for their own hook. Build hooks receive graceful termination, so handle SIGTERM and clean up temporary resources. Do not infer a derivation name from an opaque temporary build-directory name.

NixOS migration workflow

  1. Evaluate with warnings enabled and resolve removed or renamed options.
  2. Build without switching and inspect the resulting unit and boot changes.
  3. Check database and service-data migrations, secret paths, filesystem types, and initrd device paths.
  4. Use a test or boot activation only after rollback access is confirmed.
  5. Treat switch inhibitors as actionable checks; use NIXOS_NO_CHECK=1 only for an understood emergency override.
  6. Reboot when changing the D-Bus implementation or other changes that cannot be completed safely by a live switch.

Nixpkgs package review

For every package update:

  • Flatten nested build and runtime input lists.
  • Check for dangling or build-directory symlinks.
  • Keep env as an attribute set and use env.env for a variable literally named env.
  • Confirm meta.mainProgram, since it now affects the build environment.
  • Add explicit dependencies for split tools, metadata, modules, and wrapper outputs.
  • Re-run fixed-output hash discovery after changing language-specific dependency fetchers.
  • Check platform floors, toolchain defaults, filesystem feature requirements, and provider defaults rather than inheriting them accidentally.

Home Manager review

Do not invoke a generated activation script as if it owned profile updates. Use supported switch flows, choose legacy profile management only as a temporary bridge, and consider login-time activation for late-mounted homes. When raising home.stateVersion, audit application paths, generated formats, service integration, automatic updates, and renamed per-profile options.

Final verification

After a change:

  • Run evaluation and the narrowest relevant build or check.
  • Confirm lock-file changes are intentional and usable by deployment clients.
  • Verify store paths remain rooted for as long as needed.
  • Exercise parsers against the selected JSON schema.
  • Inspect generated systemd units and secret references.
  • Confirm hooks and cache clients behave under concurrency and authentication failures.
  • Keep rollback generations until stateful migrations are verified.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/nix-knowledge-patch-mt9mgmuv/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/nix-knowledge-patch-mt9mgmuv' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/nix-knowledge-patch-mt9mgmuv/download' --output '.skill-downloads/nix-knowledge-patch-mt9mgmuv/SKILL.md.part' && mv '.skill-downloads/nix-knowledge-patch-mt9mgmuv/SKILL.md.part' '.skill-downloads/nix-knowledge-patch-mt9mgmuv/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/nix-knowledge-patch-mt9mgmuv/SKILL.md' && test -s '.skill-downloads/nix-knowledge-patch-mt9mgmuv/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/nix-knowledge-patch' && cp -R '.skill-downloads/nix-knowledge-patch-mt9mgmuv' '.claude/skills/nix-knowledge-patch'

Cursor
test -f '.skill-downloads/nix-knowledge-patch-mt9mgmuv/SKILL.md' && test -s '.skill-downloads/nix-knowledge-patch-mt9mgmuv/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/nix-knowledge-patch' && cp -R '.skill-downloads/nix-knowledge-patch-mt9mgmuv' '.cursor/skills/nix-knowledge-patch'

Codex
test -f '.skill-downloads/nix-knowledge-patch-mt9mgmuv/SKILL.md' && test -s '.skill-downloads/nix-knowledge-patch-mt9mgmuv/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/nix-knowledge-patch' && cp -R '.skill-downloads/nix-knowledge-patch-mt9mgmuv' '.agents/skills/nix-knowledge-patch'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/nix-knowledge-patch-mt9mgmuv'

openskills read 'nix-knowledge-patch-mt9mgmuv'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/nix-knowledge-patch-mt9mgmuv/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills