Skip to content
Back to skills

Nix Knowledge Patch

ASecurity

Nix

  • 25 stars
  • 0 votes
  • 1 copy
  • 4 views
  • Added September 5, 2026
developmentpythonrustgoc++bashsqlnodegitapidatabase

Works with

  • terminal
  • cli
  • api

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill nix-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Nix Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Nix Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-nix-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-nix-knowledge-patch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: nix-knowledge-patch
description: Nix
version: null
license: MIT
metadata:
  author: Nevaberry
---


# Nix compatibility guidance

Load this skill when upgrading Nix, NixOS, Nixpkgs, or Home Manager;
adapting package builders or modules; or updating flake, store, CLI,
and C/C++ integrations. Use the topic references for complete details
and examples. Retain each item's product, release, state-version, and
experimental-feature conditions when applying its guidance.

## Reference index

| Reference | Topics |
| --- | --- |
| [Nix language, CLI, flakes, and APIs](references/nix-language-cli-flakes.md) | Evaluation, diagnostics, Git sources, flake locks, REPL, JSON formats, profiles, C/C++ integration, installation |
| [Stores, builds, transports, and caches](references/stores-builds-caches.md) | Build directories and hooks, daemon access, garbage collection, sandboxing, HTTP/SSH, S3, signing, compression, content addressing |
| [NixOS systems and services](references/nixos-systems-services.md) | Rebuilds, activation, initrd, filesystems, networking, authentication, containers, databases, service migrations, desktop configuration |
| [Nixpkgs packaging](references/nixpkgs-packaging.md) | Evaluator requirements, toolchains, derivation attributes, dependencies, language builders, fetchers, library helpers, package selection |
| [Home Manager](references/home-manager.md) | Activation, profiles, channels, user services, Darwin agents, applications, editors, state-version defaults |

## Breaking changes and deprecations

### Evaluation and daemon compatibility

Nix 2.25.0 makes signed 64-bit integer overflow an evaluation error;
`builtins.fromJSON` rejects integers above that range. Numeric settings
in a flake's `nixConfig` must be nonnegative. Nix 2.32.0 requires daemon
worker protocol 18 or later on both sides: upgrade clients and daemons
older than Nix 2.0 before connecting them to Nix 2.32.
Nixpkgs 25.11 requires Nix 2.18 or later to evaluate.

### Derivation and path-info JSON consumers

Nix 2.32.0 represents store paths in derivation JSON by basename;
resolve them against the store directory when absolute paths are needed.
In Nix 2.33.0, `nix derivation show` emits version 4, nests the map under
`derivations`, and moves inputs to `inputs.srcs` and `inputs.drvs`.
`nix derivation add` requires version 4. With `nix path-info --json`,
choose `--json-format 1` or `--json-format 2`; omitting it warns and
selects version 1. Readers should accept unfamiliar fields because
fields can be added without incrementing `version`.
In Nix 2.35.2, format 3 opts into signature objects with `keyName` and `sig`.

### Flake locks and fetcher compatibility

Relative repository inputs such as `inputs.foo.url = "path:./foo";`
require Nix 2.26 or newer to read their lock files. When generating locks,
Nix uses the global registry and command-line `--override-flake` mappings;
user and system registries no longer affect that resolution.
Declare an explicit input URL when a specific source is required.
In Nix 2.35.2, the `github:` fetcher rejects invalid parameters such as `tag`.
Tarball references using `file:` require absolute paths in Nix 2.34.0.

### Literal lints and structured derivations

In Nix 2.34.0, `lint-url-literals` replaces the `no-url-literals`
experimental feature, and `lint-short-path-literals` replaces
`warn-short-path-literals`. These and `lint-absolute-path-literals`
accept `ignore` (default), `warn`, or `fatal` (a parse error).
Passing serialized JSON through a derivation's `__json` is deprecated;
set `__structuredAttrs = true` in the attributes to `builtins.derivation`.

### Build storage, hooks, and incomplete caches

Since Nix 2.30.0, `build-dir` defaults to `$NIX_STATE_DIR/builds`, normally
`/nix/var/nix/builds`; set it explicitly if relying on `$TMPDIR` or `/tmp`.
In Nix 2.32.0, temporary directory names become independent of the derivation;
treat them as opaque. In Nix 2.35.2, `post-build-hook` instances can run
concurrently up to `max-jobs`; make custom hooks safe for parallel execution.
Dependent builds start after the prerequisite hook finishes.
If a cache overlays a backing cache, list both in `substituters`: Nix no
longer combines missing-dependency builds with downloads of dependent
paths from an incomplete cache closure.

### NixOS rebuilds, switches, and initrd

On NixOS 26.05, remove `system.rebuild.enableNg`: the Bash rebuild
implementation is gone. Reloading or restarting units from activation
scripts is deprecated for removal in 26.11. The D-Bus implementation
defaults to `"dbus-broker"`; changing it inhibits a live switch, so activate
at boot or keep `services.dbus.implementation = "dbus";`.
For LUKS root with the default systemd initrd, set `fileSystems."/".device`
to `"/dev/mapper/<name>"` using `boot.initrd.luks.devices.<name>`.
Use a stable device path wherever `/dev/root` was used.
Set `fileSystems.<mount>.fsType` explicitly; `"auto"` requests detection.
The system reference retains timeout, recovery, SSH, and scripted-initrd details.

### Service ordering and state migrations

Since NixOS 25.05, `multi-user.target` no longer waits for
`network-online.target`; services needing connectivity must have their
own dependency and ordering. On NixOS 25.11, database-writing services
should require and order after `postgresql.target` so PostgreSQL is writable
and initialization and ensure scripts have finished.
For ACME, use `acme-<certname>.service` for a syntactically valid certificate;
replace `acme-finished-<certname>.target` dependencies with
`acme-order-renew-<certname>.service` for issuance or renewal.
System activation can finish before issuance or renewal completes.

### Application database upgrades

Upgrade Nextcloud one major version at a time with an explicit
`services.nextcloud.package`. For a v31 instance moving to v33 on NixOS
26.05, finish the v32 upgrade with `pkgs.nextcloud32` first; v31 was removed.
That release always uses VectorChord for Immich: finish migration and
drop the pgvecto.rs extension before upgrading. Mattermost 11 removes
MySQL support, so migrate remaining MySQL deployments to PostgreSQL first.
The system reference includes earlier Nextcloud transitions and the
database, secret-file, state-directory, and authentication migrations
for GitLab, PostgreSQL, MySQL, mail, web, and collaboration services.

### Package attributes and dependency roles

Nixpkgs 25.11 requires `env` to be an attribute set in `stdenv.mkDerivation`
and wrapper builders; use `env.env = "value";` for a variable named `env`.
Nixpkgs 26.05 makes `buildEnv` use only structured derivation attributes.
Nested build and runtime input lists in `mkDerivation` are deprecated;
concatenate conditional lists instead.
For package checks, executables belong in `nativeCheckInputs` or
`nativeInstallCheckInputs`, while linked libraries belong in `checkInputs`
or `installCheckInputs`. Preserve build/host roles in cross builds.

### Rust, Go, and Python builders

When moving to `fetchCargoVendor` in Nixpkgs 25.05, regenerate `cargoHash`
from the old `fetchCargoTarball` output and replace `cargoSha256`.
Use `env.CGO_ENABLED = 0;` in `buildGoModule`; the old top-level setting
warns in 25.05 and fails evaluation in 25.11. Top-level `GOOS` and `GOARCH`
error in 25.05. Nixpkgs 25.11 requires an explicit Python build format;
for setuptools with PEP 517 use `pyproject = true;` and
`build-system = [ setuptools ];`. Nixpkgs 26.05 rejects populated
`pytestFlagsArray`; use `pytestFlags` and the test, path, and mark options.

### Node.js tooling and package scopes

In Nixpkgs 26.05, `nodePackages` and `node2nix` are removed; use surviving
packages at `pkgs.<name>`. Replace Yarn 1 tooling with `yarnConfigHook`,
`yarnBuildHook`, and `yarnInstallHook`. Replace `pnpm.fetchDeps` and
`pnpm.configHook` with `fetchPnpmDeps` and `pnpmConfigHook`.
For fetcher versions 1 or 2, set `fetcherVersion = 3;` and regenerate
the hash before removal of the older formats in 26.11.
The packaging reference also retains Darwin platform limits, hardening
changes, library renames, and application-specific package migrations.

### Home Manager profiles and configuration

Custom callers of generated activation scripts should update the
`home-manager` profile themselves. NixOS and nix-darwin integrations no
longer create the separate per-user profile unless
`home-manager.enableLegacyProfileManagement` is enabled; standalone
activation still updates it by default for compatibility.
Use `home-manager switch --rollback` for the preceding generation and
`home-manager switch --specialisation NAME` for a named specialisation.
Move SSH configuration to `programs.ssh.settings` and Neovim Lua to
`programs.neovim.initLua`. The Home Manager reference keeps the
`home.stateVersion` conditions for XDG locations, Firefox, Neovim,
Hyprland, Git signing, macOS applications, and automatic upgrades.

## Frequently used features

### Flake prefetching, checks, and formatters

`nix flake prefetch-inputs .` fetches every input in parallel, including
inputs evaluation may leave unfetched. `nix flake prefetch --out-link`
can link the source. `nix flake check` can skip downloading cached check
outputs; build checks explicitly if a later CI step needs them locally.
In Nix 2.35.2, `--print-out-paths` prints check outputs and `--out-link`
creates opt-in links. `nix fmt` passes no arguments to its formatter;
use `nix fmt .` to pass the directory. `nix formatter build` builds and
links the current flake's formatter and prints its executable path.

### Store roots, durability, and deletion

Use `nix copy --profile` for a profile pointing to the copied top-level
path, or `--out-link` for links to copied top-level paths. This protects
them from concurrent garbage collection between copying and rooting.
Enable `fsync-store-paths` to flush new paths before valid registration;
it defaults to `false`. To collect only dead paths in a closure, use
`nix store delete --recursive --skip-alive "$store_path"`; add
`--also-referrers` to include eligible referrers. Explicit deletion no
longer follows `keep-outputs` or `keep-derivations` in Nix 2.35.2.

### Evaluation diagnostics and output

Use `--eval-profiler flamegraph` for collapsed evaluator stacks;
`--eval-profile-file` selects the output and `--eval-profiler-frequency`
changes the default 99 Hz rate. Set `trace-import-from-derivation` to
warn while still allowing imports from derivations. `json-log-path`
copies all Nix log messages as JSON to a file or Unix domain socket.
JSON output is pretty-printed to terminals and single-line to files or
pipes; `--pretty` and `--no-pretty` override that choice.

### Cache transports and experimental stores

For HTTP/3, set `http3 = true` or pass `--http3`; it is off by default
and requires libcurl with HTTP/3 support. Nix falls back to HTTP/2 or
HTTP/1.1 when the server does not advertise QUIC. HTTPS substituter URLs
accept `tls-certificate` and `tls-private-key` for client authentication.
S3 details include SSO, WebIdentity, ECS credentials, endpoint addressing,
multipart uploads, object versions, and retry settings in the store reference.
`nix store roots-daemon` with `use-roots-daemon`, and the local-store setting
`ignore-gc-delete-failure`, require experimental `local-overlay-store`.
Build-trace guidance for `ca-derivations` remains experimental.

Files in this skill

  • SKILL.md9.4 KB
  • coverage.json1.7 KB
  • references/home-manager.md5.1 KB
  • references/nix-language-cli-flakes.md9.7 KB
  • references/nixos-systems-services.md13.3 KB
  • references/nixpkgs-packaging.md10.1 KB
  • references/stores-builds-caches.md9.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.