codebam/hermes-skills/nixos-flake-maintenance

Claude Code and agent skill by codebam/hermes-skills

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when fixing NixOS flake builds or trimming packages.

Install

npx vskill@latest install codebam/hermes-skills/nixos-flake-maintenance

SKILL.md

The same SKILL.md was published earlier as codebam/hermes-skills/nixos-flake-maintenance.

NixOS flake maintenance (codebam/nixos)

Repo: /persistent/etc/nixos. Hosts: nixos-desktop, nixos-laptop, nixos-steamdeck, plus homeConfigurations."droid@debian". Shared config lives in home/ and modules/; per-host dirs sit at the top level.

When to Use

  • A nixos-rebuild / flake build fails and the failing derivation is not one the user wrote — trace who pulls it in and remove it. If the failing package is current nixpkgs and upstream itself broke it at the locked rev (a build flag newer/older than the source understands), it is a transient regression instead: pin-and-wait or a local override, never removal — see the update-regression procedure below.
  • Evaluation dies inside a flake input's own /nix/store/<hash>-source/nix/*.nix (lib.customisation.callPackageWith: Function called without required argument "<arg>", or a head-builtin trace whose derivations are home-manager-generation/home-manager-files). The missing argument is usually at the user's re-call of an upstream internal file, not upstream's fault — see the flake-input procedure below.
  • The user asks what a package is for, wants to stop depending on something, or wants a package added/changed in the config.
  • nix flake update leaves the tree non-evaluating: an option was removed, a package attribute moved into a scope, or a package that comes from a flake input stops linking although its own rev did not change — see the lock-bump procedures below.
  • The config builds fine but a DESKTOP behaviour did not change (default app, mime handler, portal, what opens a link) — that is a resolution problem in the app's desktop-file id, not a build problem: use nixos-xdg-default-apps.

Standing preferences

  • When a package in the closure breaks its build, prefer REMOVING the dependency over repairing the broken package (no patches, overlays, or doCheck = false workarounds unless asked). Show where the package is used and what is lost, then remove it; only add a replacement binding or tool when the user asks.
  • One edit to a shared module (home/, shell-common.nix) covers all three hosts and the droid home config — make the change once, don't repeat it per host.

Procedure: stop depending on package X

  1. Find the consumers in nixpkgs:

np=$(nix eval --raw '.#nixosConfigurations.nixos-desktop.pkgs.path') grep -rln "<x>" "$np/pkgs/by-name" Then grep the config repo for each consumer name to see which are actually installed.

  1. Confirm the chain on the affected host:

nix why-depends --derivation '.#nixosConfigurations.<host>.config.system.build.toplevel' <consumer.drv> Check the override-variant pitfall before trusting a "does not depend" result.

  1. Remove the consumer: drop it from package lists, delete the config that uses it (tmux bindings pin binaries by ${pkgs.X} store path), fix comments that name it.
  2. Verify all three: grep -rn "<name>" . --include='*.nix' returns nothing; nix why-depends --derivation ... says "does not depend" for the consumer and for X; the toplevel still evaluates (a successful why-depends run re-evaluates it, which proves eval).

Procedure: failure inside a nixpkgs-packaged tool (update regression)

Symptom: after nix flake update, something the user did not write (Lix itself, a language runtime) starts failing mid-build in a configure-style phase, while the previous rev built. Recipe file: references/nixpkgs-regression-triage.md — its section 6 covers Rust build scripts that want a "system" library (a crate override's buildInputs never reach a cargo build).

  1. Read the package expression in the LOCKED nixpkgs, not the error text: np=$(nix eval --raw '.#nixosConfigurations.<host>.pkgs.path' 2>/dev/null). Versioned package sets (lixPackageSets, …) share ONE expression across every version, so a flag added for the newest version can break every older pinned one.
  2. Diff that file between the old and new locked revs via raw.githubusercontent.com/NixOS/nixpkgs/<rev>/<pkgs/path>. Classic culprit: a build flag the newest source version declares and older ones do not — meson hard-errors on an unknown -D option, it does not warn.
  3. Confirm the option/attribute exists (or not) in the upstream source at the pinned tag before asserting anything about it — fetch the source's own option file, don't reason from memory.
  4. Never say "the fix is upstream, just update again" from master alone: fetch the file at the branch the flake actually tracks (.../nixpkgs/nixos-unstable/<path>). nixos-unstable can lag master by days or sit on the broken rev. State the branch head you observed and the time you observed it (the user audits present-tense claims).
  5. If the tracked branch is still broken, offer the local scope-level override and verify by evaluation first: the unpatched attr's .drvPath must equal the drv in the user's failure output (that proves you reproduced their failure), and the patched one must drop the offending flag. Then ask Nix what it would do: nix build --dry-run --impure --expr '<flake attr>' — "will be fetched" means the minimal override reproduced the exact drv upstream's fix produces and the cache already has it, so fetch it and run the binary instead of building; "will be built" means a real build is still the only proof.

Consumers inside a versioned set take the package from the scope (self.lix), so overriding only nix.package still leaves nix-eval-jobs/colmena pulling the broken derivation — override the whole scope AND repoint pkgs.lixPackageSets at the patched instance so anything else reading the set gets it too (committed shape in modules/lix.nix; full template in the recipe file). Construct the patched scope from prev inside the overlay: an overlay that redefines pkgs.lixPackageSets cannot build it from pkgs — that is a self-reference.

User's pin: modules/lix.nix sets nix.package = pkgs.lixPackageSets.latest.lix and inherits nixpkgs-review, nix-eval-jobs, nix-fast-build, colmena from the same scope, so a nixpkgs regression in the lix scope lands on every host.

Procedure: evaluation dies inside a flake input's own nix/ file

Symptom: evaluation aborts in a /nix/store/<hash>-source/nix/<file>.nix the user did not write, with a missing callPackage argument. The store path is only the input's source; the call that lacks the argument is normally in the user's own repo.

  1. Locate the caller before reading upstream. grep -rn "<file>.nix" --include='*.nix' . — a hand-rolled pkgs.callPackage "${inputs.<input>}/nix/<file>.nix" { ... } is the failing call, and it is the one that must gain the argument or go.
  2. Read the function's argument list and upstream's own call site in the pinned source: grep -n "<arg>\|<file>.nix" /nix/store/<hash>-source/nix/*.nix. Upstream computes the argument in a let binding of its package expression and passes it explicitly (<arg> = callPackage ./<argfile>.nix { ... }; then inherit ... <arg>;). pkgs.callPackage resolves only package-set attributes, so those local bindings are unreachable by a re-call — do not add them to pkgs and do not rebuild the chain by hand first.
  3. Ask whether the re-call's reason still exists before repairing it. A local callPackage of upstream internals is a workaround for an upstream defect (a pinned fetchurl/hash, an unfree dep, a missing flag). Grep the new upstream file for the mechanism it patched: no fetchurl / artifacts.<vendor> / --nodedir=${pinned path} left means upstream absorbed the fix. Then the correct change is deleting the override, not teaching a dead workaround the new argument.
  4. Prefer the module's passthru default. The option description names it: programs.<x>.desktop.package defaults to config.programs.<x>.package.<passthruName>. It is a callPackage result, so the module's own .override { extraEnv; extraRun; } still applies and the launcher environment is unchanged. Delete package = <localOverride>; plus the let bindings that existed only for it, then re-grep: only comments may still name the upstream file.
  5. Verify the phase that failed, then the wiring. nix eval --raw '.#nixosConfigurations.<host>.config.system.build.toplevel.drvPath' must succeed (that is the eval gate; ~40 s on the desktop host). Then nix eval --raw '.#nixosConfigurations.<host>.config.home-manager.users.<user>.programs.<x>.desktop.package.drvPath' and prove the new argument reached the build: nix-store -q --references <drv> | grep -iE '<arg-dep>|electron'. nix build --dry-run on that attr shows the real rebuild cost — a package bump legitimately rebuilds its venv and renderer closure (hundreds of derivations is normal, not a symptom).
  6. If the re-call genuinely must stay, take the argument from the passthru upstream already exposes — pkgs.callPackage "${inputs.<input>}/nix/<argfile>.nix" { venv = pkg.passthru.<venvAttr>; } — and pass the passthru attr; never reconstruct the internal let-binding chain.

Procedure: evaluation fails right after a nixpkgs bump

Symptom: nix eval ...config.system.build.toplevel fails on a commit that only changed flake.lock, with The option definition 'services.<x>' ... no longer has any effect or undefined variable '<pkg>' inside a with pkgs; [ ... ] list.

  1. Removed option: the rename map names the replacement.

np=$(nix eval --raw '.#nixosConfigurations.<host>.pkgs.path'); grep -n '"<option>"' "$np/nixos/modules/rename.nix" prints the mkRemovedOptionModule message and the new option name. Read the new module's options before rewriting: a rename usually changes the shape, not just the name (services.scx.{enable,scheduler} became services.scx-loader.{enable,config.default_sched}, the scheduler now being TOML config validated against the chosen schedsPackages).

  1. Undefined attribute: the package moved, it did not disappear. Grep

the locked nixpkgs tree ($np/pkgs) and each flake input's source for the pname — nix eval --raw --impure --expr '(builtins.getFlake "git+file://<repo>").inputs.<input>.outPath' then grep -rn "<pname>" <outPath> --include='*.nix'. A package that an overlay used to expose at top level may now sit in a scope: Jovian's steamdeck-firmware is pkgs.jovianPackages.steamdeck-firmware (the same package the Jovian module itself uses — select it, do not re-add it to pkgs).

  1. Fix every host, not just the failing one. The removed option is

normally defined in modules/ and overridden per host, so grep the repo for the old name before saving; a shared-module break makes master non-evaluating for all hosts.

  1. A flake only sees tracked files. A new helper/module file that is

not git added is invisible to nix build/nix eval (getting status of '/nix/store/...-source/<file>': No such file or directory). Stage it before evaluating, and commit before pointing a worktree or a target host at the revision.

Procedure: a flake input's package stops linking after a nixpkgs bump

Symptom: after nix flake update, a package supplied by a flake input fails at link time (cannot find -l<lib>) although that input's own rev did not change.

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/codebam/hermes-skills/nixos-flake-maintenance/badge)](https://verified-skill.com/skills/codebam/hermes-skills/nixos-flake-maintenance)

Something wrong with this skill or its page? Tell us.