2.2 KiB
name, description
| name | description |
|---|---|
| update-package-hashes | Update a package in packages/ to a new version and refresh its hashes (src, vendorHash, npmDepsHash, cargoHash, etc.) WITHOUT compiling the package. Use when the user asks to bump, update, or upgrade a specific package under packages/. Requires package name and target version/rev. |
Update Package Hashes (Without Building)
Require the user to supply the package name and target version/rev/tag. Ask if missing.
Hard Rule
Never run nix build .#<pkg> — it compiles. Only realise FOD sub-attributes (.src, .goModules, .npmDeps, .cargoDeps) which are pure downloads.
Flow
-
Edit
packages/<name>/default.nix— bumpversion/rev/tag. Check for sibling.nixfiles (e.g.ui.nix). -
srchash — usenurl(downloads source only, prints the fetcher expression):nix run nixpkgs#nurl -- https://github.com/<owner>/<repo> <tag-or-rev>Paste the new
hash = "sha256-..."into thesrcblock. -
Dependency hashes (
vendorHash,npmDepsHash,cargoHash,cargoLock.outputHashes.<crate>) — after the version bump the old hash is already wrong, so just trigger the mismatch:nix build .#<name>.goModules --no-link 2>&1 | tee /tmp/hash.log # or .npmDeps / .cargoDeps grep -E '^[[:space:]]*got:' /tmp/hash.log | tail -1 | awk '{print $2}'Paste into the matching attribute.
-
Custom fetchers (
leaveDotGit,postFetch,fetchSubmodules) —nurlwill be wrong. Use the same mismatch trick on.src:nix build .#<name>.src --no-link 2>&1 | tee /tmp/hash.logApplies to
llama-cppandllama-swap. -
Opaque
outputHashFODs (e.g. opencodenode_modulesrunsbun install) — do NOT attempt locally. Leave as-is and flag for CI in the summary. -
Show
git diff -- packages/<name>/and list any hashes left for CI.
Notes
- Don't touch hashes whose inputs didn't change (e.g.
slack-cli's pinnedpython-snappy/zstd-python). - Resolve a tag → rev without cloning:
git ls-remote <url> refs/tags/<tag>. nix-update --flake <name> --version <v>can sometimes do all of this; try it first for simple packages.