Repository navigation
Conversation
…to get one meta attribute
…t to get the description
…yError when forceValue'd
…ors must be assumed not to be prebuilt
…h, and meta attributes
None of the cases that turned handling off didn't have readOnly set anyway.
…tion in read-only mode, we shouldn't throw an exception just because we're trying to check for substitutable paths
…ith imports from derivations
Rather than relying on magic characters and string scanning to extract information out of a string context, a string's context is now a structured data type. To avoid fragmentation and extra allocations, the context struct and the memory for the strings it points to are all allocated in one call.
Conflicts: src/libexpr/primops.cc
…faces in libstore, and use them to see if a file to be imported has a substitute
…it exists and is needed
…pied-to-store path when necessary
…re actually needed
|
Giving up on this getting merged |
|
Pity to see this closed, but has your thinking re: the problem changed at all since this solution? I find myself wanting the behavior. Would you still implement it this way? |
|
@copumpkin I think as long as we care about read-only evaluation, this kind of approach is the only way to handle "building at eval time". Since doing this work, though, I've come to appreciate the "evaluate at build time" (i.e. recursive nix) approach to the kinds of problems this would solve, especially given the "derivation replacement" model I came up with in my implementation. |
|
@copumpkin This is actually the latest version of the work in #31, sorry |
|
Ah oaky, thanks! @edolstra can we reopen this one then? 😄 |
There was a problem hiding this comment.
why do you need .outPath here?
|
@shlevy when you have some time, do you think you could:
Thanks for all the great work! I hope to be able to revive it and get more of it merged |
|
Reopened so @copumpkin can take over. |
|
So there are multiple things happening in this branch. The first half makes nix-env -q lazier and aware of readonly errors, so if it can complete its query without importing from derivation it will and if it can't it will simply skip that drv as if it threw an assert error. The second half adds the concept of a file substituter, which can provide various bits of information that would otherwise require building during evaluation to determine (though no actual file substituter is added, just the protocol). |
|
@copumpkin Are you planning on reviving this? |
|
@copumpkin will reopen if so |
IPFS Header for ipfs-develop
Remove flake-compat input
Each candidate that has been addressed by a pushed cleanup branch now carries a **Branch:** line under its **Validation:** paragraph, naming the vibe-coding/cleanup/* branch on origin that lands the change. Cross-references: - vibe-coding/cleanup/libexpr-friend-dup -> NixOS#217 (duplicate-line removal only; the broader Counter -> Statistics promotion remains as future work) - vibe-coding/cleanup/libfetchers-curl-stub -> NixOS#52 - vibe-coding/cleanup/libflake-lockfile -> NixOS#48 - vibe-coding/cleanup/libmain-shared -> NixOS#49, NixOS#128 - vibe-coding/cleanup/libstore-dead-decls -> NixOS#54, NixOS#56, NixOS#57, NixOS#60 - vibe-coding/cleanup/libutil-misc -> NixOS#58, NixOS#130 - vibe-coding/cleanup/nix-run -> NixOS#127, NixOS#142 Two non-branch outcomes folded in: - NixOS#50 (nix_value_incref forwarders): resolved-by-design after re-reading the C-API header. The forwarders are the migration *target*, not the debt; the typed nix_value_decref form supersedes the @deprecated generic nix_gc_decref. No code change. - NixOS#148 (windowSize() un-leak): reclassified INVALID after an adversarial review pass identified a static-destruction-order hazard. The leak is load-bearing because ~ProgressBar runs from static destruction and the in-flight update-thread draw() iteration calls getWindowSize() -> windowSize().lock(). A function-local static would be destroyed before that lock; UAM. Same hazard class as getInterruptCallbacks; documented in the expanded comment landed on vibe-coding/cleanup/libutil-misc. NixOS#56 (BaseSetting<SandboxMode>::trait header move) and NixOS#57 (COMMA_ macro hygiene) gained extra detail: NixOS#56 is also a real ODR fix (different TUs saw different definitions of the explicit specialisation), and NixOS#57's implementing PR also caught a third leaking macro (LENGTH_PREFIXED_PROTO_HELPER_X) that the original framing missed. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The static StringSet was declared but never defined or referenced. Refs candidate NixOS#52. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…xes + libmain code-review parity Final cleanup pass after the bidirectional traceability audit. Audit findings: 0 phantom Branch lines, 0 wrong-fix commits, 7 orphan commits (bodies missing Refs candidate lines), 4 stale Branch line texts where Pass-B amends shifted the implementation without updating the catalog. All 7 orphans fixed via per-shard rebase amends adding the missing candidate references (libexpr 18-commit rebase for NixOS#217, libfetchers 2-commit rebase for NixOS#52, libflake 2-commit rebase for NixOS#48, libmain single-commit amend for NixOS#49+NixOS#128, libstore 23-commit rebase for NixOS#54+NixOS#56+NixOS#57+NixOS#60, libutil 7-commit rebase for NixOS#58+NixOS#130 and the NixOS#148-tied catalog-cleanup commit, nix-cli 12-commit rebase for NixOS#127+NixOS#142). All 4 stale Branch lines re-synced. `/code-review` skill brought to parity on libmain — three-agent fan-out reported clean across reuse / quality / efficiency. Final tip SHAs after the orphan-fix rebases: libexpr 9d33402cc, libfetchers dc5dc00, libflake fd75c93, libmain f9da474, libstore e7e885bc3, libutil 18a82b524, nix-cli ef32368. All seven branches still Local-only past their pushed tips; push policy is explicit-only. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
`assertCacheStats <hits> <misses> <fallbacks> -- <cmd>` runs cmd with NIX_CACHE_STATS_FILE pointing at a tmp sidecar, then locks in the exact counter tuple from NixOS#52. Prints a diff-style message on mismatch. cb-stats-sanity.sh exercises the helper against a trivial cached attrset: cold record asserts 1 miss / 0 hits / 0 fallbacks, warm replay asserts 6 hits / 0 misses / 0 fallbacks. Counts calibrated from observed behaviour — any future regression that changes the trie shape silently will trip this. Assisted-by: Claude Code (Claude Opus 4.6-4.7)
This branch (which includes my structured-context work and the better errors when importing from derivations work) adds some new substituter operations (--query haveFile, --query fileInfo, and --read) that should provide enough information to determine if a substitute is available for a derivation that requires importing from another derivation to be realised. Essentially, a substituter can serve up information about some files (type, length, recursive hash, etc., used by coerceToString with copyToStore=true) and the full contents of some regular files (used by prim_import), allowing the import from derivation to be done without the full derivation being realised.
This does not update any real substituters to support these new operations, though tests/file-substituter.sh shows the interface they must follow.
A sketch of how this might be used: I import build.nix from nix's tarball, and the substituter gives back the full nix expression which gets parsed and evaled. build.nix builds individual .c files, so the substituter tells me the recursive hash of those files (but it doesn't need the full contents) so nix can determine the hash of compileC derivations.
There are other operations (e.g. readFile) which might want to use this file substituter mechanism in the import-from-derivation case, but import and coerceToString seemed the most important.