Updating and selecting Pins
Update all Pins
nix-pins update
nix-pins update --report-json report.json --report-markdown report.md
Without names, --filter, or --failed, the command processes every configured Pin. A full update also removes Pins and failure records that are no longer in the configuration from the Pins File. Pass --report-json PATH or --report-markdown PATH to write a CI-friendly change summary (added, updated, unchanged, removed, and failed Pins) atomically after pins.json is saved.
Select Pins to update
nix-pins update patchelf ripgrep
nix-pins update --filter '^python-'
nix-pins update --failed
nix-pins update patchelf --filter '^python-' --failed
Names, regular expression matches, and --failed (configured Pins with recorded failures in the Pins File) are combined as a union. Every explicit name must exist. A --filter selection whose union matches nothing is an error; --failed alone with no configured failures succeeds without modifying the Pins File. Selective updates leave locked entries outside the selection unchanged, including entries removed from the configuration.
Sources and Packages cannot be selected individually. A Pin updates only after all of its Sources succeed.
Inspect without updating
nix-pins
nix-pins status
nix-pins status patchelf
nix-pins status --failed
nix-pins status --json
nix-pins status --failed --json
nix-pins check
nix-pins check --json --exit-code
With no subcommand, the CLI runs status. It reads existing locked results and the last recorded failures. Pass --json to emit a machine-readable JSON report (schemaVersion: 1) containing selected pins (pinned state, version, sources, failure) and summary counts; errors still write to stderr with empty stdout.
To check upstream versions without downloading sources or modifying the Pins File, run nix-pins check. Pass --json for machine-readable output (outdated, unpinned, up-to-date, failed) and --exit-code in CI to exit with code 2 when updates are available (or 1 on errors/failures).
Source hash reuse
Standard Fetchers reuse their locked Source hash when the full parameters and Nix string dependency context match, even if the derivation path changes. This avoids repeated probes caused only by nixpkgs updates. The supported parameters are listed below; any other parameter keeps the derivation fingerprint check.
| Fetcher | Required parameters | Optional parameters |
|---|---|---|
url | url | name |
npm | url | name |
zip | url | name, stripRoot, extension |
github | owner, repo, rev | name, githubBase, forceFetchGit, fetchSubmodules, fetchLFS, sparseCheckout, nonConeMode, rootDir |
git | url, rev | name, fetchSubmodules, fetchLFS, sparseCheckout, nonConeMode, rootDir |
huggingface | repoId, rev, backend = "lfs" | name, sparseCheckout |
For github, git and huggingface, rev must be a full 40-digit hexadecimal commit SHA. Branches, tags, short SHAs, custom processing such as postFetch, and options that retain Git metadata still use the derivation fingerprint. Pin-level patches / postPatch run after fetching and do not prevent reuse of the original Source hash. Dependency hashes still use the derivation fingerprint.
This policy trusts locked content. It does not detect upstream replacement at the same URL or recompute hashes solely because a Fetcher or unpacking tool was upgraded. If implementation changes cause a hash mismatch in a later build, explicitly refresh the Source hash. Reusing a hash does not retain downloaded files: using the Source may still require a download after Nix garbage collection.
To recompute every Source hash in the update selection, bypassing both locked results and the persistent hash cache:
nix-pins update editor --refresh-sources
This flag does not expand the selection or force dependency hash recalculation. Normal dependency fingerprint checks still apply after the Source hash is resolved. Successful probes update the hash cache; failures preserve the Pin's previous locked results. The flag has no effect on status.
Failures and cancellation
Configuration errors fail the entire operation before any Checker runs. A runtime failure in one Pin does not stop other Pins from updating. Failed Pins retain their previous usable contents. If the first attempt to lock a Pin fails, only a failure record is saved; no Pin entry with a fake hash is created.
Successful results are written together atomically to the Pins File at the end. Cancellation leaves the Pins File unchanged. A write lock prevents multiple processes from writing the same Pins File concurrently.
Resolved Source Hashes and Derived Hashes are cached immediately, independently of the Pins File. After cancellation, the next update reuses cached hashes when the fake-hash derivation path is unchanged. A different derivation path misses this cache, but Source hashes in the Pins File may still be reused under the rules above. This caches hashes, not downloaded files or build outputs; Nix may still need to fetch or build those if they are absent from its store.
The cache lives in $XDG_CACHE_HOME/nix-pins/hashes-v1, or ~/.cache/nix-pins/hashes-v1 when XDG_CACHE_HOME is unset. Cache entries are replaced atomically. Unreadable or invalid entries are ignored; a cache write failure emits a warning without discarding the resolved hash. Removing this directory clears the hash cache without changing the Pins File.
Interactive terminals show Pin, Source, and Package progress. Redirected output and CI use text output. A completed indicator means computation succeeded; committing results to the Pins File happens during the final write.
Stage dependencies
Each Checker can release its Pin immediately; downloads and Package work overlap other version checks. Explicit references wait only for the required result. See Dependencies between Pins for Version, Source and Package references, input snapshots and late failure propagation.
Selective updates use locked startup results outside the selection. Add --refresh-dependencies to recursively include prerequisites; automatically included Pins are labelled (dependency).
Automated CI updates
For scheduled Pull Requests on GitHub Actions, copy examples/ci/nix-pins-update.yml into .github/workflows/nix-pins-update.yml. The workflow runs nix-pins doctor, executes nix-pins update --nixpkgs flake:nixpkgs --report-markdown nix-pins-report.md, passes NIX_PINS_GITHUB_TOKEN from secrets.GITHUB_TOKEN, and opens or updates a PR via peter-evans/create-pull-request with the rendered Markdown change summary as the PR body.
To run a read-only drift check before updating (for example in a separate alert job), use:
nix-pins check --nixpkgs flake:nixpkgs --json --exit-code
To temporarily pin or roll back a single Pin without modifying pins-config.nix, use:
nix-pins update patchelf --version 0.18.0