Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Nix Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-nix-knowledge-patch-nevaberry-plugins)
---
name: nix-knowledge-patch
description: Nix
version: null
license: MIT
metadata:
author: Nevaberry
---
# Nix Compatibility Guidance
Load this skill when updating Nix expressions or CLI integrations, flake inputs,
stores and remote builders, NixOS modules, Nixpkgs packages, or Home Manager configurations.
Use the relevant reference for the complete migration details and examples.
Keep each entry's release, platform, experimental-feature, and state-version conditions attached to its advice.
## Reference index
| Reference | Topics |
| --- | --- |
| [Core CLI, Evaluation, and Configuration](references/core-cli-evaluation.md) | Installation, environment, integer evaluation, literal lints, REPL, JSON schemas, profiling, diagnostics |
| [Flakes and Fetchers](references/flakes-and-fetchers.md) | Relative inputs, registry resolution, locks, Git and LFS, lazy source copies, tarballs, prefetching, checks |
| [Home Manager](references/home-manager.md) | Activation, profiles, channels, Darwin agents, SSH, editors, desktop settings, state-version defaults |
| [Native APIs and Source Builds](references/native-api-and-source-builds.md) | C and C++ API migrations, lazy values, callbacks, plugins, Meson, source dependencies |
| [NixOS System and Service Migrations](references/nixos-system-and-services.md) | Rebuilds, boot, storage, networking, authentication, systemd dependencies, databases, service migrations |
| [Nixpkgs Packaging](references/nixpkgs-packaging.md) | Toolchains, cross compilation, derivation attributes, language builders, fetchers, library helpers, package replacements |
| [Stores, Caches, and Remote Builds](references/stores-caches-and-remote-builds.md) | Daemons, sandboxing, garbage collection, SSH, HTTP and S3, retries, signing, compression, content addressing |
## Breaking changes and deprecations: Nix
### Evaluation and derivation attributes
Integer arithmetic outside the signed 64-bit range fails evaluation; `builtins.fromJSON` rejects integers above that range.
Numeric settings in a flake's `nixConfig` must be nonnegative.
Passing serialized JSON through a derivation's `__json` is deprecated; set `__structuredAttrs = true` in the attributes passed to `builtins.derivation`.
### Flake locks and registry resolution
Lock files recording relative path inputs require Nix 2.26 or newer.
When generating a lock file, Nix resolves indirect inputs through the global registry and command-line `--override-flake` mappings.
User and system registry entries no longer affect that resolution; declare an explicit input URL when a flake needs a specific source.
### Daemon and build-directory compatibility
The daemon worker protocol requires version 18 or later on both sides; upgrade clients and daemons older than Nix 2.0 before connecting them to Nix 2.32.
`build-dir` defaults to `$NIX_STATE_DIR/builds`, normally `/nix/var/nix/builds`; set it explicitly if relying on `$TMPDIR` or `/tmp`.
Temporary directory names under `build-dir` are independent of the derivation; treat them as opaque.
### Machine-readable output
`nix derivation show` emits a top-level `version` of `4` and a `derivations` map; `nix derivation add` requires version 4.
Derivation store paths are basenames, and `inputSrcs` and `inputDrvs` move to `inputs.srcs` and `inputs.drvs`.
Select `nix path-info` JSON with `--json-format`; readers should accept unfamiliar fields because fields may be added without incrementing `version`.
Use `--json-format 3` for signatures with `keyName` and `sig`; consult the core reference for the complete format distinctions.
### Literal lints
`lint-url-literals` replaces the `no-url-literals` experimental feature; `lint-short-path-literals` replaces `warn-short-path-literals`.
These and `lint-absolute-path-literals` accept `ignore` (default), `warn`, or `fatal` (a parse error).
```ini
lint-url-literals = fatal
lint-short-path-literals = warn
lint-absolute-path-literals = warn
```
### Fetching, substitution, and hooks
`builtin:fetchurl`, exposed as `<nix/fetchurl.nix>`, verifies TLS certificates; invalid HTTPS certificates cause fetches to fail.
For a binary cache overlaying a backing cache, list both in `substituters`: Nix no longer combines builds of missing dependencies with downloads of paths depending on them from an incomplete cache.
`post-build-hook` instances can run concurrently up to `max-jobs`; make custom hooks safe to run in parallel. Dependent builds start after the prerequisite hook finishes.
## Breaking changes and deprecations: NixOS
### Initrd and filesystems
With the systemd initrd default in NixOS 26.05, set a LUKS root's `fileSystems."/".device` to `"/dev/mapper/<name>"`, using `boot.initrd.luks.devices.<name>`.
Use a stable device path wherever `/dev/root` was used. For stacks such as LVM on LUKS, set `"x-systemd.device-timeout=infinity"` in root mount options if passphrase entry can time out.
In an initrd shell, use `systemctl default` for passphrase prompts and `ssh -o RequestTTY=force` when piping a passphrase over SSH.
Set `fileSystems.<mount>.fsType` on every mount; use `"auto"` for detection. When overriding a built-in filesystem entry, include its `device`.
### Rebuilds and live switches
On NixOS 26.05, remove `system.rebuild.enableNg` because the Bash implementation is gone.
Reloading or restarting units from activation scripts is deprecated for removal in 26.11.
`services.dbus.implementation` defaults to `"dbus-broker"`; changing it inhibits a live switch. Activate at boot or set `"dbus"` to keep the classic daemon.
### Network readiness
`multi-user.target` no longer waits for `network-online.target`. Give each service needing connectivity its own dependency and ordering.
```nix
systemd.services.my-service = {
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
};
```
### Database readiness and application upgrades
Order database-writing services after `postgresql.target` and pull it in as a dependency so PostgreSQL is writable and initialization and ensure scripts have finished.
For Nextcloud, set `services.nextcloud.package` explicitly during upgrades and proceed one major version at a time.
On NixOS 26.05, upgrade v31 to v32 with `services.nextcloud.package = pkgs.nextcloud32;` before selecting v33; v31 has been removed.
Immich always uses VectorChord on NixOS 26.05; complete the migration and drop the pgvecto.rs extension before upgrading.
Mattermost 11 removes MySQL support; migrate remaining MySQL deployments to PostgreSQL first.
### Structured settings and runtime secrets
Move `systemd.extraConfig` and `boot.initrd.systemd.extraConfig` to `systemd.settings.Manager` and `boot.initrd.systemd.settings.Manager`.
Move `services.logind.extraConfig` entries to `services.logind.settings.Login`.
Move sleep and coredump configuration to `systemd.sleep.settings.Sleep` and `systemd.coredump.settings.Coredump`.
Replace OAuth2 Proxy's `clientSecret` and `cookie.secret` with `services.oauth2-proxy.clientSecretFile` and `services.oauth2-proxy.cookie.secretFile` so values stay out of the store.
## Breaking changes and deprecations: Nixpkgs
### Evaluator, environment, and structured attributes
Nixpkgs 25.11 requires Nix 2.18 or later to evaluate.
`stdenv.mkDerivation` and wrapper builders require `env` to be an attribute set; export a variable literally named `env` with `env.env = "value";`.
With `separateDebugInfo` and reference constraints, set `__structuredAttrs = true;`; those constraints are disabled for the resulting `debug` output.
`buildEnv` environments use only structured derivation attributes in Nixpkgs 26.05; attached custom build logic must handle them.
Nested lists in `mkDerivation` build and runtime inputs are deprecated; concatenate conditional lists instead.
### Rust and Go builders
`rustPlatform.buildRustPackage` defaults to `fetchCargoVendor`; regenerate `cargoHash` when upgrading from `fetchCargoTarball` output.
Use `useFetchCargoVendor = true;` for packages also targeting 24.11, and replace remaining `cargoSha256` arguments with `cargoHash`.
Use `env.CGO_ENABLED = 0;` in `buildGoModule`; the top-level form fails evaluation in Nixpkgs 25.11.
Top-level `GOOS` and `GOARCH` error. `buildGoModule` replaces the removed `buildGoPackage`.
### Python builders and test arguments
Declare the build format explicitly in `buildPythonPackage` and `buildPythonApplication`.
For a setuptools PEP 517 build, use `pyproject = true;` and `build-system = [ setuptools ];`.
For custom stdenv selection, override the builder with `buildPythonPackage.override { stdenv = customStdenv; }` before passing package arguments.
In Nixpkgs 26.05, populated `pytestFlagsArray` values are rejected; migrate to `pytestFlags` and the `enabled*` or `disabled*` options for tests, paths and marks.
Clear an inherited value with `pytestFlagsArray = null;` or `pytestFlagsArray = [ ];` in an override.
### Node and dependency fetchers
Use surviving `pkgs.<name>` packages in place of `pkgs.nodePackages.<name>`; `nodePackages` and `node2nix` are removed in Nixpkgs 26.05.
For Yarn 1, use `yarnConfigHook`, `yarnBuildHook` and `yarnInstallHook` instead of removed `yarn2nix` tooling.
Replace `pnpm.fetchDeps` and `pnpm.configHook` with `fetchPnpmDeps` and `pnpmConfigHook`.
For fetcher versions 1 or 2, set `fetcherVersion = 3;` and regenerate the dependency hash before the older formats are removed in 26.11.
## Breaking changes and deprecations: Home Manager
### Activation and profile ownership
`systemd.user.startServices` defaults to `true`; `"legacy"` fails evaluation and `"suggest"` remains available.
Custom callers of a generated activation script 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.
### SSH and editor configuration
Move SSH client configuration to `programs.ssh.settings`; deprecated `programs.ssh.matchBlocks` migrates automatically.
Rename `programs.neovim.extraLuaConfig` to `programs.neovim.initLua`.
If you own `$XDG_CONFIG_HOME/nvim/init.lua`, set `programs.neovim.sideloadInitLua = true;` to load Home Manager's Lua through the wrapper.
Move VS Code fork configurations to their dedicated modules; see the Home Manager reference for the module names and MCP integration.
### State-version-dependent defaults
At `home.stateVersion` 26.05, Neovim plugin config defaults to Lua and both `withPython3` and `withRuby` default to `false`.
Hyprland's `wayland.windowManager.hyprland.configType` defaults to `"lua"`; set `"hyprlang"` to retain the generated `hyprland.conf` format.
The flake auto-upgrade service's pre-switch hooks default to an empty list; set `services.home-manager.autoUpgrade.preSwitchCommands = [ "nix flake update" ];` if each automatic switch should update inputs.
## Frequently used features
### Profiles, formatting, and JSON output
Use `nix profile add`; `nix profile install` remains an alias.
`nix fmt` invokes the formatter without arguments; `nix fmt .` passes the current directory explicitly.
`nix formatter build` builds and links the current flake's formatter and prints its executable path.
With `--json`, terminal output is pretty-printed and file or pipe output is single-line; use `--pretty` or `--no-pretty` to override that choice.
`nix-instantiate --eval --raw` prints a string verbatim; evaluation must produce a string.
### Flake inputs and checks
Use `inputs.foo.url = "path:./foo";` for a flake in the same repository.
A Git-backed flake can declare `inputs.self.submodules = true;` and `inputs.self.lfs = true;`.
`nix flake prefetch-inputs .` fetches every input in parallel, including inputs normal evaluation might leave unfetched.
`nix flake check` can skip downloading cached check outputs; build checks explicitly if a later CI step needs them in the store.
Use `nix flake check --print-out-paths --out-link ./check-result` to print outputs and opt into links.
### Evaluation profiling and logging
Use `--eval-profiler flamegraph` for collapsed evaluator stacks, `--eval-profile-file` to replace the `nix.profile` destination, and `--eval-profiler-frequency` to change the 99 Hz sampling rate.
Set `trace-import-from-derivation` to log warnings while continuing to allow import from derivation.
Set `json-log-path` to copy Nix log messages as JSON to a file or Unix domain socket.
### Store roots and transport
`nix copy --profile` roots the copied top-level path; `--out-link` creates links to copied top-level paths, protecting them from concurrent garbage collection between copying and rooting.
`nix store delete --recursive --skip-alive "$store_path"` collects only dead paths in that closure; `--also-referrers` includes eligible referrers.
Runtime roots over `nix store roots-daemon` with `use-roots-daemon` require the `local-overlay-store` experimental feature.
HTTP/3 is off by default; `http3 = true` or `--http3` requires libcurl with HTTP/3 support and falls back when the server does not advertise QUIC.
### Native API integration
Use `nix/<component>/...` C++ headers and remove forced `-include` flags for configuration headers.
For direct feature-macro reads, include the component configuration header; installed configuration headers expose only public macros.
Attach flake settings to the C evaluator builder after creating it and before building the evaluation state; `nix_flake_init_global` was removed.
The native API reference includes the exact calls, lazy collection access, recoverable primop errors, and version-specific callback fixes.