--assume-cache no-ops on Nix 2.30+ — output_paths returns bare (unprefixed) store paths #24
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
graph.output_paths(drv)claims to return full/nix/store/…output paths, but under the versioned derivation schema (Nix 2.30+, observed schema v4) the per-outputpathfield is BARE — e.g.3pcn0admdqrrd0k405y9hyad4579wgb3-hello-2.12.3with no/nix/store/prefix (same bare-key change that affected inputDrvs). Consequences for--assume-cache(#22):substitutable_pathspasses these bare paths tonix path-info --json --store <cache>, which needs full store paths, so the query returns nothing; and_parse_path_inforeturns full-path keys whilefilter_upstream_substitutablecompares against the bareoutput_paths, so even a working query wouldn't match. Net effect:--assume-cachesilently drops nothing and prints the "offline / old nix / flag mismatch" no-op warning on a fully-online, modern Nix (reproduced on the emmett NixOS closure, schema v4). The legacy schema already has full paths, so this is versioned-schema-only.Fix: normalize output paths to full
/nix/store/<basename>inoutput_paths(prepend the store prefix when the path is bare / doesn't start with/), so queries and set-membership are consistent. Add a regression test:output_pathson a versioned-schema drv (barepath) returns the/nix/store/…-prefixed form; and an end-to-endfilter_upstream_substitutabletest with bare-path outputs + a monkeypatched query that keys by full path drops the right drvs. Minor:nix path-info --jsonnow warns "--json without --json-format is deprecated" — harmless (stdout still JSON) but worth pinning--json-format 1/2 handling later.Discovered validating #22 on emmett.
the versioned derivation schema (Nix 2.30+, schema v4) stores output paths bare (no /nix/store/ prefix); output_paths now normalizes them to full store paths so --assume-cache actually queries the cache and matches results. Regression tests added for bare-path normalization and end-to-end filtering. This was what made --assume-cache a no-op on modern Nix.