Skip to content

Add the nix-store --serve command - #204

Closed
shlevy wants to merge 2 commits into
NixOS:masterfrom
shlevy:ssh-substituter
Closed

shlevy wants to merge 2 commits into
NixOS:masterfrom
shlevy:ssh-substituter

Conversation

@shlevy

@shlevy shlevy commented Feb 6, 2014

Copy link
Copy Markdown
Member

This is essentially the substituter API operating on the local store,
which will be used by the ssh substituter. It runs in a loop rather than
just taking one command so that in the future nix will be able to keep
one connection open for multiple instances of the substituter.

This is essentially the substituter API operating on the local store,
which will be used by the ssh substituter. It runs in a loop rather than
just taking one command so that in the future nix will be able to keep
one connection open for multiple instances of the substituter.

Signed-off-by: Shea Levy <[email protected]>
@shlevy

shlevy commented Feb 6, 2014

Copy link
Copy Markdown
Member Author

@edolstra Might be a good basis for the ssh substituter. If you don't find a chance before I can find some spare time I'll try implementing it on top of this.

nix-store --export takes a tmproot, which can only release by exiting.
Substituters don't currently work in a way that could take advantage of
the looping, anyway.

Signed-off-by: Shea Levy <[email protected]>
@shlevy

shlevy commented Feb 8, 2014

Copy link
Copy Markdown
Member Author

Have an ssh substituter implementation now, will open that PR instead

@shlevy shlevy closed this Feb 8, 2014
zolodev pushed a commit to zolodev/nix that referenced this pull request Jan 1, 2024
zolodev pushed a commit to zolodev/nix that referenced this pull request Jan 1, 2024
new hydra link to the aarch64 sd image
P-E-Meunier pushed a commit to P-E-Meunier/nix that referenced this pull request Feb 26, 2025
nix-prefetch-git should be available in the shell
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request May 24, 2026
Landed 18 commits across 6 shards covering 20 candidates:
- libstore +8 (NixOS#1+NixOS#3, NixOS#7, NixOS#11, NixOS#55, NixOS#59, NixOS#101, NixOS#153, NixOS#185)
- libexpr +3 covering 4 (NixOS#192, NixOS#202+NixOS#203 folded, NixOS#204)
- libutil +4 (NixOS#97, NixOS#124, NixOS#167, NixOS#224)
- libfetchers +1 (NixOS#53)
- libflake +1 (NixOS#133, rename only — deviation documented)
- libmain +1 (NixOS#223; NixOS#222 already on branch)

Skipped: NixOS#76 (libc++ in dev shell lacks <generator>) and several
RED-bucket items.

4-pass review chain: Pass A (parallel adversarial) caught 2
BLOCKERS — libstore NixOS#153 over-broad rename corrupted the
external-builders JSON wire-key, and libutil NixOS#97 dropped the
inline allowed-name list breaking eval-fail-hashString-2.err.exp.
Both fixed via amend; parseEnumOrThrow extended to render
'a', 'b', or 'c' with Oxford comma + suggestions. Pass B
(/code-review) found no blockers; substantive amends include
libexpr's callFunction hot-path now reading a ctor-frozen
profilerHooks snapshot, libstore's tryUpperFallLower returning
std::pair<R, bool>, libutil completing three migration gaps.
Pass C found one real clang-tidy error (parse-enum.hh missing
configuration.hh include); other shards only show the 5 known
pre-existing master errors. Pass D nix build -L . green on all
six shards.

New catalog candidates surfaced by review: NixOS#225 (libfetchers
getUserRegistry/getSystemRegistry/getGlobalRegistry share NixOS#53's
first-call-wins shape on the hot path), NixOS#226 (showCompressionAlgo
vs printHashAlgo enum-rendering inconsistency).

Catalog total: 226 + 44.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request May 24, 2026


Seven candidates filed across six section files, raising the
catalog total to 233 + 44:

- NixOS#227 EvalProfiler NVI cache + default no-op virtuals dead
  post-NixOS#204                                  → 20-eval-core-cache-attrset-profiler.md
- NixOS#228 bitAnd/bitOr/bitXor twin family adjacent to
  primNumeric<NumOp>                         → 08-duplicated-parsers.md
- NixOS#229 SeenSet = set<const void *> widening
  type-erasure regression                    → 13-libexpr-extras.md
- NixOS#230 GitArchive subclass DRY-ing post-NixOS#51
  trim                                       → 03-repeated-boilerplate.md
- NixOS#231 nix-env --priority hand-rolled
  getArg+string2Int pattern                  → 11-legacy-cli.md
- #232 ignoreExceptionInDestructor
  non-destructor audit (~17 libstore sites)  → 07-dead-stale-code.md
- NixOS#233 schema-migration-style scaffolding
  thrice (cross-shard)                       → 17-cross-cutting.md

Each entry carries a verdict, effort, and cross-refs back to its
parent candidate (NixOS#67 / NixOS#110 / NixOS#51 / NixOS#128 / NixOS#58 / NixOS#55 etc.) so the
discovery context survives.

Catalog header tables and INVENTORY/STATUS totals updated to
reflect the 226 → 233 bump. FOLLOWUPS.md Batch D struck.

No code change; doc-branch only.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request May 24, 2026
Replaces `EvalState`'s `MultiEvalProfiler profiler;` member with two
`std::optional<ref<EvalProfiler>>` members named `functionCallTrace`
and `sampleStackProfiler`. The two registration sites in the
`EvalState` ctor body now set these directly, and the hot-path
`callFunction` dispatch tests each independently.

Rationale: `MultiEvalProfiler` existed to fan out to a
`vector<ref<EvalProfiler>>`, but in tree there are exactly two
concrete `EvalProfiler` subclasses (`FunctionCallTrace` from
`function-trace.hh` and the anonymous `SampleStack` returned by
`makeSampleStackProfiler`). Each is registered conditionally on a
single setting, so the live size of the vector is 0, 1, or 2.
Dispatching through a virtual `MultiEvalProfiler` to iterate a
two-element vector is over-engineering for what the call graph
actually exercises. Two named optionals make the conditions explicit
at the field level, and the hot-path dispatch avoids a vector probe
per call.

Public-API note: `eval-profiler.hh` ships via `install_headers`. The
`MultiEvalProfiler` class is removed from the public API; external
consumers that subclassed or instantiated it (Hydra, Lix, plugins)
will need to update.

Refs candidate NixOS#204.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request May 24, 2026
…ixOS#227)

After NixOS#204 froze the per-EvalState `profilerHooks` snapshot at
construction, three pieces of `EvalProfiler` infrastructure became
unreachable:

- The `private std::optional<Hooks> neededHooks;` lazy cache field
  with its compute-once-and-store body.
- The `getNeededHooksImpl` NVI indirection (no in-tree subclass
  ever overrode it after `getNeededHooks` was inlined into the
  ctor).
- The default no-op `pre/postFunctionCallHook` bodies in
  `eval-profiler.cc` — both `FunctionCallTrace` and `SampleStack`
  override them.

Drop the cache, rename `getNeededHooksImpl` → `getNeededHooks`
(now a public direct virtual), and mark all three virtuals pure.
`FunctionCallTrace` and `SampleStack` are updated accordingly.

`eval-profiler.hh` ships via install_headers, so this is a
public-API tightening: external `EvalProfiler` subclasses (if any
exist in Hydra/Lix/plugins) must now implement all three
methods, not rely on the default no-op hooks. Documented in the
queued rl-next entry; the hooks were impractical to leave
unimplemented anyway since neither default body was ever used
in-tree.

Refs candidate NixOS#227. Compounds with NixOS#204.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant