Repository navigation
Updated instructions and scripts for non-NixOS multi-user installations - #135
svanderburg wants to merge 1 commit into
Conversation
… added profile.d script supporting multi-user installations
|
Bump. |
|
+1 |
|
The problem with this PR is that 1) installing system services is highly distribution-specific; 2) init.d is old-school, the world (even Debian!) is moving to systemd; 3) there are no tests so it will likely suffer from bitrot in the future. (Note that the RPM spec in nix.spec.in uses a systemd unit.) The documentation changes can be merged though. |
1 similar comment
|
The problem with this PR is that 1) installing system services is highly distribution-specific; 2) init.d is old-school, the world (even Debian!) is moving to systemd; 3) there are no tests so it will likely suffer from bitrot in the future. (Note that the RPM spec in nix.spec.in uses a systemd unit.) The documentation changes can be merged though. |
|
Also, it adds |
|
nix-profile-multiuser.sh is the alternative profile.d script (replacing nix.sh) allowing someone to use multi-user settings. The latter script (nix-daemon.sh) is the old fashioned init.d script, but we can also consider not to include it since it's distribution specific (or perhaps use it as an example somewhere). @edolstra What do you think about the alternative profile.d script for multi user installations? Should we make this optionally configurable somehow and keep the single user variant the default? I was thinking to put this alternative script in the share/ folder of the Nix installation and to explain users in the manual how to replace the single user profile.d script with the multi-user variant + some additional instructions describing the remaining steps to make it work. For testing this I'm not yet sure how to do this. I think I have to check how the testsuite is implemented first. |
|
Is this thread dead? Running into issues with the manual and multi-user on CentOS 7. nix-daemon not found. |
|
I've succeeded today in installing multi-user Nix on CentOS 7 via |
|
For reference, here's the resulting script: https://gist.github.com/abbradar/8603326a3dbe66ab09baaa213904b176 |
|
@abbradar yes, let's update the manual. Can you do a PR? |
|
Sure, I'll look at it later. Just in case -- @svanderburg, are you okay with me making a PR with (basically) your profile script? Maybe you want to work on this by yourself? |
|
Another comment for myself to fix later -- RPM script creates |
|
I've finally got motivation to work on this: see #1141 |
|
@abbradar you may be interested in the instructions I've written here: https://gist.github.com/expipiplus1/e571ce88c608a1e83547c918591b149f |
|
@expipiplus1 #1141 does seemingly just that, so good to hear that's a well-known way! Can you try if it works for you if you use Debian/Red Hat derivatives? |
|
@abbradar I've already got a multi user nix setup going here, but next time I need to set one up I'll give your work a try! |
|
Closing this since the installer has multi-user support now. We don't have a sysvinit script, but probably not too many people care about that nowadays... |
Sync with upstream 2.30.0
Fixes NixOS#135, NixOS#136 Co-authored-by: Commentator2.0 <[email protected]> Change-Id: Ia1880633c1ee3b9242487fbc30b6d781d88987fb
The catalog has accumulated enough cross-pass review work to need a permanent rule about what counts as evidence. Prior passes shipped findings that turned out to rest on weak ground: - E2 grep'd `nix::settings.*` field reads in src/*-c/ and concluded no settings type was exposed across the C ABI. V1 found that 5 of 6 C-API libraries install their *_internal.h(h) files, exposing layout to C++ consumers through the public include path. The inventory was correct; the conclusion was wrong because it reasoned about source-tree contents rather than shipped headers. - E6 predicted "16/22 fixtures fit cleanly" for an N41 consolidation; V5 verified each fixture against the source body and corrected to "27/28 with (subdir, suffix)". The catalog body did not mark E6's numbers as predicted. - The "NixOS#136 keystone for NixOS#134/NixOS#135/NixOS#137/NixOS#144/NixOS#149" chain propagated through three passes before B1 found that NixOS#135 does not actually depend on NixOS#136. Citation alone is not evidence; later passes inherited prior framing without re-deriving. - E8 wrote "negligible performance benefit" without measuring; V4 confirmed Direction A on four non-perf grounds and downgraded the perf framing. - E4 reported "61 positional-format sites in libstore" as wire-crossing without filtering by reachability from a daemon-side WorkerProto::Op handler. (V2 still in flight.) - B2 found that forceAttrs/forceList look like the rest of the force* family but use withTrace rather than addTrace+try/catch. The "10 force* overloads" claim was structurally similar function names treated as the same problem. Add an "Evidentiary standard" section to candidates/README.md enumerating eight rules: 1. Walk the call graph (behaviour claims trace at least one caller; lifetime claims trace destruction order). 2. Trace what ships, not what is in src/ (ABI claims must check install rules). 3. Counts require closed enumeration. 4. Distinguish predicted from verified. 5. Re-derive inherited claims (citation alone is not evidence). 6. "Same shape" is not "same problem". 7. Numbers require measurement (or label "structural reasoning, unmeasured"). 8. Comments are hypotheses; verify against code. Add review/AGENT-CHARTER.md as the operational form of the same rules, intended for any future agent prompt to reference. The charter requires every report to include a Method section, a per-rule statement of which rules were exercised, and per-claim verifiability labels (verified / predicted / unsupported). Also drops the prior "8 verified counts" snapshot from INVENTORY.md and replaces it with a pointer to the per-section catalog (the snapshot was stale by the time the consolidation pass ran). Drops one count line that referenced WorkerProto::latest as "1.38" without disambiguating from the PROTOCOL_VERSION macro (now 1.39); the macro and the struct are two genuinely different version handles, see review/F3-proto-version-drift.md. Lands all completed review reports under doc/inventory/review/: E1-E8 + F1-F3 + B1-B3 + C1 + V1, V3, V4, V5. V2 still in flight and will land separately. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Folds the findings from E1-E8, F1-F3, B1-B3, C1, and V1-V5 into the candidate sections as in-place body edits. Each affected candidate now carries a See also: line pointing at the verifying report(s); counts are re-derived where the V-pass produced a verified number; mechanism corrections from source-level investigations replace inherited framing. Substantive corrections to existing candidates: - NixOS#134 / NixOS#135 / NixOS#138 (15-globals-settings.md): - B1 found that the catalog's "NixOS#136 keystone for NixOS#134/NixOS#135/NixOS#137/ NixOS#144/NixOS#149" chain is wrong about NixOS#135. The body's keystone block now lists only NixOS#134/NixOS#137/NixOS#144/NixOS#149 as NixOS#136-blocked; NixOS#135 is independent. The reasoning is preserved in NixOS#134's and NixOS#135's bodies (asymmetry between virtual-base diamond and inline-member flattening). - V1 found that 5 of 6 C-API libraries install_headers with their *_internal.h(h) files, exposing layout to C++ consumers. The NixOS#138 body now spells out the C++ ABI caveat for deleting the dead nix::ref<bool> readOnlyMode field, with a release-note requirement. - F1+V3 confirmed (via end-to-end source trace) a latent UAF in the _new-without-_load path: the heap bool is destroyed by nix_eval_state_builder_free while the resulting EvalState still holds a bool * to it. NixOS#138's body now folds the UAF repair into the readOnlyMode -> Store migration, so deleting the dangling field sweeps the bug away in the same change. - NixOS#65 / NixOS#211 (08-duplicated-parsers.md, 21-eval-core-evalstate-value.md): - B2 verified by source reading that NixOS#65 has 79 canonical-template sites plus ~135 bespoke. NixOS#211 has 7 structurally-shared bodies, not 10 and not 16: forceAttrs/forceList use withTrace (a different shape) and forceString(NixStringContext &, ...) / forceStringNoCtx delegate to the single-overload forceString. The catalog's proposed merge of NixOS#65+NixOS#211 was rejected on different-risk-profile and different-consumer-scope grounds. NixOS#211 first (~1 week, internal); NixOS#65 second (~4-6 weeks, user-visible trace migration). - NixOS#213 (21-eval-core-evalstate-value.md): - E8+V4 recommend Direction A on four non-perf grounds. V4 downgraded the unsupported "negligible perf benefit" framing and surfaced a critical observation: ExprOpEq::eval evaluates into stack-local Value v1/v2 and ExprVar::eval ends with v = *v2; — the highest- frequency eqValues caller cannot benefit from canonical pointer- equality regardless of direction. - NixOS#18 (03-repeated-boilerplate.md): - B3 verified the hand-written CloneableError derivation count is 17 (catalog said 14). 18a (the MakeError macro itself) is not a real refactor target because MakeError already is CRTP sugar. 18b is per-class because most carry intrinsic payload. 18c is too small for top-level status. Body now documents the SQLiteBusy/SQLiteError cross-link and the BadNixStringContextElem/GitError err.msg- mutation fragility. - NixOS#166 (17-cross-cutting.md): - E7 verified per-file unique-header counts: 8 Source, 5 Sink, 20 Store, 12 EvalState, 7 Value, 6 StorePath, 10 StoreDirConfig. Recommendation: ship serialise-fwd.hh AND store-fwd.hh AND eval-fwd.hh together. Self-forward-decl caveat: don't replace the inline self-decls in store-api.hh and eval.hh. Zero C-API impact. - NixOS#125 (14-vestigial-stdlib.md): - E4+V2+F2 verified the wire-crossing scope. Daemon does NOT link libexpr; libexpr's 107 throws are local-only. Wire-crossing surface is libstore (199 throws, 71 positional %N%, 51 reachable) plus libutil (281 all-format, 50 positional, 45 reachable). V2 found 5 categories of sites E4's grep missed including the load-bearing store-api.hh::Store::requireStoreObjectAccessor. F2 found a second wire-crossing text-grep contract: "is not valid" in BasicClientConnection::queryPathInfo. Phasing constraint: text-grep contracts span both %s and %1% sites; Phase 2 cannot batch positional and non-positional separately for any contract-bearing site. - NixOS#128 (14-vestigial-stdlib.md): - Note added per CLAUDE.md: the landed cleanup/libmain-shared branch bundled this with the unrelated blockInt deletion (NixOS#49). Soft style issue; recorded for future cleanup-branch authors. - NixOS#140 (15-globals-settings.md): - E1's verification cleared the deletion path. nm -m on the built dylib confirms internal linkage; lix already deleted it; commit 50912d0 (2022-03-31) intended full removal but missed the namespace-scope definition. - N41 (24-test-infrastructure-mirrors.md): - V5 verified each fixture body. 28 declaring fixture classes (E6's "22" was an undercount). 19 fit cleanly with subdir-only ctor; 27 of 28 fit with (subdir, suffix) ctor pair. One structural hazard: CaDerivationAdvancedAttrsTest reassigns unitTestData in SetUp() and is linked to DerivationAdvancedAttrsTest via TYPED_TEST_SUITE — needs common abstract base. New candidate NixOS#218 (12-libutil-libstore-core-extras.md): - The Hash::dummy / StorePath::dummy sentinels are overloaded as both "uninitialised placeholder" and "wire-marker for missing". Independent grep identified 16 sites in three classes: placeholder-then-overwrite (6, including two FIXME-tagged sites in nar-info.cc), wire-marker (3 in worker-protocol.cc, serve-protocol.cc, legacy-ssh-store.cc), and test-fixture (3 + one legitimate constant). The right factoring is std::optional<Hash> / std::optional<StorePath> for the placeholder sites and a separately-named sentinel for the wire-marker sites. Resumption documentation: - INVENTORY.md was missing pointers to STATUS.md, AGENT-CHARTER.md, and review/00-INDEX.md. Added a paragraph after the "Consolidated duplication and refactoring candidates" section documenting all three plus the five-step read-first ordering for resumption. - INVENTORY.md updated: 217 per-shard candidates -> 218 (with NixOS#218 added during integration). - STATUS.md cleaned up: dropped the 13 stale "Integration" sub-bullets (those tasks are now in candidate bodies), collapsed the duplicate "E1 implementation" entries, fixed the vague "completed in commit ahead of HEAD~0" line, added "E3 implementation" and "E5 verifiable-counts manifest" to the queue. "Recently completed" annotated to note the post-integration count is 218 + 44. - review/00-INDEX.md updated with an integration-status note above the "How a new agent should pick a report to read" section. Self-check against AGENT-CHARTER.md eight rules: 1. Call graphs walked: V3's UAF chain through ~ProgressBar / ~InterruptCallbackImpl was already in V3's report; B1's addSetting(this) analysis already in B1's report. 2. Shipping artefacts traced: V1's install_headers finding cited in NixOS#134 and NixOS#138 bodies. 3. Counts cited their source: re-derived for the dummy pattern (16 sites) and CloneableError derivations (17); took V-counts where verified (V2's 71/281, V5's 28/19/27/1). 4. Predictions labelled: N41's V5-verified replaces E6's prediction. 5. Inherited claims re-derived: B3 said 22 hand-written CloneableError; my grep produced 17; used 17. 6. Same-shape walked individually: the dummy pattern split into 3 classes (placeholder vs wire-marker vs test) rather than C1's single shape. 7. No invented numbers: V4's downgrade applied to NixOS#213. 8. Comments verified vs code: NixOS#213's "not a singleton" comment treated as hypothesis the consumers contradict. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
LocalSettings multiply-inherited GCSettings and AutoAllocateUidSettings
purely for grouping in documentation; both bases were
"public virtual Config" with no overrides, no methods, and only
Setting<T> members. Inline those members directly into LocalSettings.
The user-facing setting names (gc-keep-outputs, gc-keep-derivations,
gc-reserved-space, min-free, max-free, min-free-check-interval,
start-id, id-count) keep their gc-/auto-allocate- prefixes via the
existing name parameter on each Setting. Setting<T>::Setting's
addSetting(this) reaches the same most-derived Config (Settings)
regardless of inheritance shape, so the registration target is
preserved.
Public ABI surface in shipped header:
src/libstore/include/nix/store/local-settings.hh ships via
install_headers. This commit removes the GCSettings and
AutoAllocateUidSettings struct types entirely, removes the
LocalSettings::getGCSettings() and ::getAutoAllocateUidSettings()
methods, and changes LocalSettings's base list from
`public virtual Config, public GCSettings, public AutoAllocateUidSettings`
to
`public virtual Config`,
which is a vtable-layout change. External consumers (Hydra, Lix,
plugins) that referenced these types or methods, or that depended
on LocalSettings's pre-batch base layout, will fail to compile or
link until they migrate to the flattened shape. Plugins compiled
against pre-batch headers cannot be loaded against post-batch
libnixstore.
Consumer updates (in-tree):
- LocalStore::collectGarbage, LocalStore::autoGC, local-store.cc
reservedSize use, nix-store/nix-store.cc opQueryReferrers, and
build/worker.cc autoGC poll now access keepOutputs / keepDerivations
/ minFree / maxFree / minFreeCheckInterval / reservedSize directly
via getLocalSettings(), without the getGCSettings() indirection.
- acquireUserLock previously did
if (auto * uidSettings = localSettings.getAutoAllocateUidSettings())
using nullptr-on-disabled as a presence check; that helper has been
inlined to "if (localSettings.autoAllocateUids)" reading the
governing flag directly.
- AutoUserLock::acquire now takes startId and uidCount as plain
parameters instead of a const AutoAllocateUidSettings &; the
body was already only reading those two fields plus accepted nrIds
and useUserNamespace as parameters.
Per the validation in the catalog, this lands independently of the
"separate Settings registration mechanism" candidate (NixOS#136) -- the
flattened Setting<T> members register on the same most-derived
Config they did before. See the B1 review report for the
source-level verification of NixOS#135's independence from NixOS#136.
Refs candidate NixOS#135.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…kipped) libstore session landed 7 of 8 queued candidates on vibe-coding/cleanup/libstore. Landed: - NixOS#26 -- pathlocks: hoisted PathLocks::lockPaths and FdLock::FdLock into shared pathlocks.cc; portable getFileSize for staleness; the Windows two-region LockFileEx trick stays in the platform shim. Linux build green; Windows untested under current CI scope. - NixOS#46 -- builtins: hoisted the getAttr lambda from buildenv and unpack-channel into BuiltinBuilderContext::getEnvAttr. The candidate's mention of fetchurl was inaccurate — that file uses at()/getOr on optional fields, not the if-end() lambda shape. - NixOS#80 -- LegacySSHStoreConfig::logFD: unified Setting<Descriptor> with a Windows-only BaseSetting<Descriptor> specialisation in the shipped header. Latent Windows bug fixed: log-fd is now respected on Windows (previously silently dropped). - NixOS#83 -- validateRuntimeRoots helper extracted; the Roots / UncheckedRoots key alignment turned out to already be done in current source. - NixOS#85 -- two file-scope templates parseStoreReferenceCollection and renderStoreReferenceCollection cover the vector and set BaseSetting specialisations; appendOrSet bodies stay inline because vector end-extend and set merge-insert genuinely differ. - NixOS#100 -- forEachConfiguredSigner extracted, helper-only scope; the cache-keys-in-memory FIXME stays as a separate follow-up. - NixOS#135 -- option (a) flatten: GCSettings and AutoAllocateUidSettings virtual base structs dropped, members inlined into LocalSettings, all consumers migrated. Re-derives B1's independence-from-NixOS#136 verification. Skipped: - NixOS#84 -- UnkeyedValidPathInfoBuilder. Read both parsers end-to-end; the prescription doesn't actually shrink either body. The "shared" data is just struct-field assignments where each setter is a one-liner equivalent to info.X = …. The only invariant the candidate hints at (self-reference rejection) doesn't currently exist in either parser; adding it would be a behaviour change orthogonal to a mechanical refactor. Effort downgraded to medium pending a real invariant to centralise. STATUS.md "Cleanup branches (live)" updated for libstore. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…amends Two new candidates filed during Pass B reuse review when the catalog gaps surfaced in the course of landing NixOS#79 and NixOS#85: - NixOS#220 (libexpr-extras): prim_path shares the iterateFetcherAttrs name-handler-table shape used by the fetcher primops. Landed on vibe-coding/cleanup/libexpr; the helper was renamed iterateFetcherAttrs → iterateNamedAttrs and the header fetcher-attr-iter.hh → named-attr-iter.hh to drop the fetcher-flavoured name. - NixOS#221 (libutil-libstore-core-extras): BaseSetting<container<T>> parse/to_string/appendOrSet is hand-rolled across six specialisations. Landed on vibe-coding/cleanup/libstore by lifting parseStoreReferenceCollection / renderStoreReferenceCollection into shipped configuration.hh as parseSettingTokens / renderSettingTokens. Per-T scope notes recorded in the candidate body: only the StoreReference pair migrates; Strings/StringSet are already one-liners over tokenizeString; list/set<path> save one line each (not worth the indirection); set<ExperimentalFeature> has irreducible warn-on-unknown semantics. The Pass-B follow-ups also amended: - NixOS#51 (libfetchers): unwrap single-field RefInfo struct to Hash; bundles the RefInfo deletion into the same delete-and-trim commit since the trim made it single-field. - NixOS#67 (libexpr): transpose primNumeric's 4×4 string-context ladders into a single per-Op NumOpDiag struct so the asymmetric "first of the multiplication" wording is visible at a glance. - NixOS#37, NixOS#163 (libutil): docstring polish (lifetime contract, intentionally-not-migrated note, PipeOptions class doc rewrite). - NixOS#100 (libstore): template forEachConfiguredSigner's printer to drop fun<> type erasure. - NixOS#135 (libstore): bundle AutoUserLock::acquire's startId/uidCount into a UidRange struct. - NixOS#74 (nix-cli): template runWholeStoreGC's printer to match runNarDump style. INVENTORY.md catalog total updated 219+44 → 221+44. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…xOS#221 + final adversarial pass Extends the most-recent batch entry with: - Six Pass-B follow-up amends (categorised after the user asked which findings were caused by our changes versus pre-existing in source): libfetchers NixOS#51 RefInfo unwrap, libexpr NixOS#67 NumOpDiag transpose, libutil NixOS#37/NixOS#163 docstring polish, libstore NixOS#100 template, libstore NixOS#135 UidRange struct, nix-cli NixOS#74 template. - Two new candidates filed and landed: NixOS#220 (libexpr, iterateFetcherAttrs → iterateNamedAttrs renamed and extended to prim_path) and NixOS#221 (libstore → libutil, parseSettingTokens / renderSettingTokens lifted into shipped configuration.hh). - Final adversarial review pass over those eight changes: libfetchers/libstore/nix-cli clean; libutil one minor (std::map::insert invalidation overclaim in fso::descendPath docstring, fixed); libexpr two minor (NixOS#220 commit body said "six-way" but pre-batch had only five attrs; ANSI coloring drift on the primop name now passing through %s coloring, acknowledged in commit body). Final tip SHAs updated: libexpr 04f4a67fd, libfetchers 5df2ffc93, libflake 02b9065c4, libstore 52963ff79, libutil 3e1bc0186, nix-cli 6692dfa88. All six branches still Local-only past their pushed tips; push policy is explicit-only. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Bidirectional traceability audit (Pass-D-aftermath) found four catalog Branch line texts whose code-description had drifted away from the actual implementation after the Pass-B follow-up amends: - NixOS#100 Branch line: said `forEachConfiguredSigner` extracted "using `fun<void(LocalSigner &)>`"; the helper is actually a `template<class Callback> static void(const Callback &)`. - NixOS#74 Branch line: didn't mention that `runWholeStoreGC` is templated on the printer callback type. - NixOS#135 Branch line: said `AutoUserLock::acquire` "now takes startId/uidCount as plain parameters"; it actually takes a single file-local `UidRange` struct. - NixOS#51 Branch line: didn't mention that the now-single-field `RefInfo` struct itself was unwrapped to use `Hash` directly. Plus one factual error in the candidate body of NixOS#220 itself: the opening sentence enumerated a "six-way" chain over `name`/`path`/`filter`/`recursive`/`sha256`/`method`, but pre-batch `prim_path` had only five handlers (`method` is computed from the boolean `recursive` attribute, not as a separate handler). The commit body of the implementing commit was already corrected; this fixes the catalog body to match. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…p amends Three new catalog candidates filed during the post-audit follow-up sweep: - NixOS#222 (libmain → 11-legacy-cli.md): --max-freed parses as int64_t then std::max-clamps before assigning to uint64_t. Implemented on vibe-coding/cleanup/libmain: both call sites switched to getIntArg<uint64_t> with the clamp dropped. User-visible behaviour change: --max-freed -1 now errors at parse time instead of silently disabling, and N above int64_t::max() is now honoured up to uint64_t::max(). - NixOS#223 (libmain → 11-legacy-cli.md): getIntArg<N> is now a 5-line wrapper; inlining at the two call sites would let it be deleted from shared.hh. Filed but NOT implemented — the inline form is 3 lines per site vs 1 line currently, and the candidate body itself notes "stylistic regression, not behavioural". - NixOS#224 (libutil → 12-libutil-libstore-core-extras.md): NarIndexer::createMember computes path depth via `for (auto _ : path) (void) _; ++level;` instead of any idiomatic accessor. Filed but NOT implemented — the cleaner factor is to add `CanonPath::numSegments()` first; deferred to a future libutil batch where canon-path.hh is already being touched. Plus four code/doc follow-up amends folded into existing commits: - libexpr NixOS#214 (eval.hh): added "// Only instantiated in eval.cc" note above the mkFailedFromCurrentException declaration to prevent future contributors from adding cross-TU callers that would link-fail. - libstore NixOS#135 (unix/user-lock.cc): nested UidRange inside AutoUserLock since it is the only user; eliminates a file-scope type for a struct used by exactly one method. - libstore NixOS#221 (configuration.hh): expanded the parseSettingTokens docstring to document why the libutil specialisations (Strings/StringSet/list<path>/set<path>/set<ExperimentalFeature>) were intentionally not migrated, so future readers don't try to "finish the job". - libutil NixOS#163 (file-descriptor.hh): added a "calling-style note" to the PipeOptions docstring documenting that pipe.create({}) is intentionally NOT recommended due to the latent ambiguity with the existing arity-asymmetric overload's default arg. INVENTORY.md catalog total updated 221+44 → 224+44. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ild-dir reconfigure After the post-audit follow-up sweep landed: - NixOS#222 implemented on libmain (a7bb49f): --max-freed parses as uint64_t directly, std::max clamp dropped. - NixOS#223 filed but not implemented (inline tradeoff documented). - NixOS#224 filed but not implemented (depends on a CanonPath accessor that hasn't been added). - Four code/doc amends folded into existing commits: libexpr NixOS#214 instantiation note, libstore NixOS#135 UidRange nested in AutoUserLock, libstore NixOS#221 doxygen scope expansion, libutil NixOS#163 PipeOptions ambiguity note. - Plus a load-bearing protocol fix: libmain build dir was misconfigured against master source per the worktree-source- drift gotcha in HANDOFF.md; reconfigured against the worktree so all subsequent builds compile the actual cleanup tree. Final tip SHAs: libexpr c9401c3, libfetchers dc5dc00, libflake fd75c93, libmain a7bb49f, libstore e565149, libutil e3f2287, nix-cli ef32368. All seven branches Local-only past their pushed tips; push policy explicit-only. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
LocalSettings multiply-inherited GCSettings and AutoAllocateUidSettings
purely for grouping in documentation; both bases were
"public virtual Config" with no overrides, no methods, and only
Setting<T> members. Inline those members directly into LocalSettings.
The user-facing setting names (gc-keep-outputs, gc-keep-derivations,
gc-reserved-space, min-free, max-free, min-free-check-interval,
start-id, id-count) keep their gc-/auto-allocate- prefixes via the
existing name parameter on each Setting. Setting<T>::Setting's
addSetting(this) reaches the same most-derived Config (Settings)
regardless of inheritance shape, so the registration target is
preserved.
Public ABI surface in shipped header:
src/libstore/include/nix/store/local-settings.hh ships via
install_headers. This commit removes the GCSettings and
AutoAllocateUidSettings struct types entirely, removes the
LocalSettings::getGCSettings() and ::getAutoAllocateUidSettings()
methods, and changes LocalSettings's base list from
`public virtual Config, public GCSettings, public AutoAllocateUidSettings`
to
`public virtual Config`,
which is a vtable-layout change. External consumers (Hydra, Lix,
plugins) that referenced these types or methods, or that depended
on LocalSettings's pre-batch base layout, will fail to compile or
link until they migrate to the flattened shape. Plugins compiled
against pre-batch headers cannot be loaded against post-batch
libnixstore.
Consumer updates (in-tree):
- LocalStore::collectGarbage, LocalStore::autoGC, local-store.cc
reservedSize use, nix-store/nix-store.cc opQueryReferrers, and
build/worker.cc autoGC poll now access keepOutputs / keepDerivations
/ minFree / maxFree / minFreeCheckInterval / reservedSize directly
via getLocalSettings(), without the getGCSettings() indirection.
- acquireUserLock previously did
if (auto * uidSettings = localSettings.getAutoAllocateUidSettings())
using nullptr-on-disabled as a presence check; that helper has been
inlined to "if (localSettings.autoAllocateUids)" reading the
governing flag directly.
- AutoUserLock::acquire now takes startId and uidCount as plain
parameters instead of a const AutoAllocateUidSettings &; the
body was already only reading those two fields plus accepted nrIds
and useUserNamespace as parameters.
Per the validation in the catalog, this lands independently of the
"separate Settings registration mechanism" candidate (NixOS#136) -- the
flattened Setting<T> members register on the same most-derived
Config they did before. See the B1 review report for the
source-level verification of NixOS#135's independence from NixOS#136.
Refs candidate NixOS#135.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
LocalSettings multiply-inherited GCSettings and AutoAllocateUidSettings
purely for grouping in documentation; both bases were
"public virtual Config" with no overrides, no methods, and only
Setting<T> members. Inline those members directly into LocalSettings.
The user-facing setting names (gc-keep-outputs, gc-keep-derivations,
gc-reserved-space, min-free, max-free, min-free-check-interval,
start-id, id-count) keep their gc-/auto-allocate- prefixes via the
existing name parameter on each Setting. Setting<T>::Setting's
addSetting(this) reaches the same most-derived Config (Settings)
regardless of inheritance shape, so the registration target is
preserved.
Public ABI surface in shipped header:
src/libstore/include/nix/store/local-settings.hh ships via
install_headers. This commit removes the GCSettings and
AutoAllocateUidSettings struct types entirely, removes the
LocalSettings::getGCSettings() and ::getAutoAllocateUidSettings()
methods, and changes LocalSettings's base list from
`public virtual Config, public GCSettings, public AutoAllocateUidSettings`
to
`public virtual Config`,
which is a vtable-layout change. External consumers (Hydra, Lix,
plugins) that referenced these types or methods, or that depended
on LocalSettings's pre-batch base layout, will fail to compile or
link until they migrate to the flattened shape. Plugins compiled
against pre-batch headers cannot be loaded against post-batch
libnixstore.
Consumer updates (in-tree):
- LocalStore::collectGarbage, LocalStore::autoGC, local-store.cc
reservedSize use, nix-store/nix-store.cc opQueryReferrers, and
build/worker.cc autoGC poll now access keepOutputs / keepDerivations
/ minFree / maxFree / minFreeCheckInterval / reservedSize directly
via getLocalSettings(), without the getGCSettings() indirection.
- acquireUserLock previously did
if (auto * uidSettings = localSettings.getAutoAllocateUidSettings())
using nullptr-on-disabled as a presence check; that helper has been
inlined to "if (localSettings.autoAllocateUids)" reading the
governing flag directly.
- AutoUserLock::acquire now takes startId and uidCount as plain
parameters instead of a const AutoAllocateUidSettings &; the
body was already only reading those two fields plus accepted nrIds
and useUserNamespace as parameters.
Per the validation in the catalog, this lands independently of the
"separate Settings registration mechanism" candidate (NixOS#136) -- the
flattened Setting<T> members register on the same most-derived
Config they did before. See the B1 review report for the
source-level verification of NixOS#135's independence from NixOS#136.
Refs candidate NixOS#135.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ALL 24% NixOS#2 vmmap + RSS-time-series RCA (cache-off, peak is monotone-at-end, not transient): M5 v3 RSS ~2900MB = arena/MALLOC_LARGE 1543MB(53%) + MALLOC_SMALL ~690MB(24%, ~360 fragmentation) + Boehm 402MB(14%) + binary 310MB(11%, fixed). Arena alone > TW's entire 982MB RSS. ImportCache (2851 results) pins Value subgraphs IN the arena (not 'elsewhere') -> eviction attacks the arena. Re-prioritizes: thunk-avoidance (NixOS#135) is now NixOS#1 (hits arena=NixOS#1 RSS AND ALLOC=NixOS#1 CPU gap); MALLOC_SMALL (C++ per-CU structures + malloc fragmentation) is NixOS#2. lode/M1_RSS_DECOMP_2026-06-23.md.
…KILL the lever
Kills hypothesis: "v3 over-creates trivial thunks (bare var-refs, constants)
that TW's maybeThunk avoids; avoiding them cuts arena RSS + ALLOC-CPU."
Measure-first (NIX_V3_THUNK_BODY_STATS, gated, now retired): categorized EVERY
thunk v3 creates at runtime by body shape.
firefox.drvPath: 2,880,002 thunks — alias(var) 0.5% + const 0.1% =
AVOIDABLE 0.7%; real deferred work 99.3%.
M5 .name: same RATIO (0.7% avoidable).
v3's opt passes (dce/beta/inline/const-fold, default-on) ALREADY remove trivial
alias/const thunks at compile time — only 0.7% survive to runtime. There is no
maybeThunk gap to close. The v3-vs-TW thunk-COUNT excess (~730K) is real
deferred subcomputations = <=17MB arena (24B/thunk), negligible vs the 1543MB
M5 arena. The 637MB thunk arena is REAL laziness (TW carries the same thunks at
16B); thunk SIZE is already at the 24B floor (FP-2 complete).
Re-prioritization (lode/M4_THUNK_AVOIDANCE_RCA_2026-06-23.md):
- Real arena RSS lever = the LIVE SET (ImportCache eviction, NixOS#134), NOT thunk count.
- Real thunk lever = CHURN (62-67% unforced, profile) — a CPU lever needing
strictness/eager-eval (byte-id risk), the L3-hard deferred item, NOT maybeThunk.
- Structural CPU lever stays JIT (NixOS#137).
Instrument retired (Rule 0: falsify -> delete code + gate); net vm.cc diff is
comment-only, hello.drvPath byte-identical.
Copyright (c) 2026 Moritz Angermann <[email protected]>, Input Output
Group. SPDX-License-Identifier: Apache-2.0
…e is now the NixOS#1 RSS lever NixOS#135 (thunk-count avoidance) falsified + killed (207c9b4): the arena's RSS is not reducible by thunk count. Promote NixOS#134 (ImportCache eviction = un-pin the live arena subgraphs) to the NixOS#1 RSS lever; JIT (NixOS#137) stays the structural CPU lever. Sequencing + M4 sections updated. Copyright (c) 2026 Moritz Angermann <[email protected]>, Input Output Group. SPDX-License-Identifier: Apache-2.0
…ement Kills hypothesis: "mid-eval arena reclaim can be made visible to the OS (mmap blocks + whole-block-free / evacuation), lowering peak RSS." Measure-first via the per-block density histogram + evac-opportunity report (NIX_VM_STATS R2.1), driven by this session's mid-eval sweep on firefox.drvPath. Both page-return mechanisms measured ~0: - whole-block-free: blocksFreed=0 on EVERY sweep (reclaim% 18->56% but not one 16MB block goes fully dead — live cells scattered across every block). - evacuation (Immix): sparseBlocks=0 at all mid-eval trigger points (blocks cluster 25-75% live, ZERO <25%); evacuable_RSS~=0. Only teardown (C-stack unwound) shows 1 sparse block (16.8MB). Plus 12-27% cells C-stack-pinned (unmovable) during mid-eval. So mid-eval reclaim CANNOT become peak-RSS reduction (confirms MIDEVAL_REUSE_RCA with the root mechanism). Even the paused multi-week Immix evacuation project (GC_DECISION/GC_PAUSE 2026-05-29) would free ~0 RSS at these density profiles. Completes the RSS-lever sweep: NixOS#135 thunk-avoidance KILL, NixOS#134 eviction KILL, NixOS#136 page-release KILL, NixOS#139 MALLOC_SMALL modest/foundational. ALL reclaim-based RSS levers dead; only path = allocate fewer/smaller cells (FP-2/3 mostly closed, churn L3-hard) + structural (MALLOC_SMALL foundational, Boehm FFI). Beating TW on RSS = shrink the LIVE representation = broad foundational program, no single lever. NixOS#138 (GC mark cost) was gated on M3 shipping a default sweep -> moot, closed. lode/M3_ARENA_PAGE_RELEASE_KILL_2026-06-23.md. Copyright (c) 2026 Moritz Angermann <[email protected]>, Input Output Group. SPDX-License-Identifier: Apache-2.0
…nk-heavy arena + 970MB dead + 1153MB VM-tax "elsewhere" + 403MB FFI boehm Measured at HEAD (arena/per-type/churn deterministic; maxRSS darwin-4 N=5). Answers "is the RSS gap the live cell representation?" — NO. M5 (3.03× TW): arena 1560MB(52%, thunks 659/bindings 347/chars 135/closures 127/pairs 125/lists 63; live ~592 → ~970 DEAD) + elsewhere ~1153MB(39%: bytecode/CU/descriptors + caches + ~360 frag + binary — alone > TW's whole 982MB RSS) + boehm ~403MB(13%, mostly reserved-free). Thunks 17.2M alloc / 63% never forced; nursery hit 7%. OVERTURNS "leaner cells": v3 Value is 8B < TW's 16B; Thunk at 24B floor. The thunks are real laziness (NixOS#135 killed maybeThunk), just stored heavier than TW's inline-in-Value. CONFIRMS the campaign verdict with decomposed numbers: 4 independent components (dead arena=reclamation-dead, thunk volume=near-floor, VM-tax elsewhere=structural, boehm=FFI floor), no single lever. The one direction moving BOTH CPU+RSS is the thunk representation (strict-eval/unboxed) — L3-hard, the deferred conclusion. Kills the "shrink the cells" RSS hypothesis: the cells are already lean; the gap is thunk COUNT + unreclaimable dead + the bytecode-VM's non-arena footprint. Doc: lode/RSS_DECOMP_FRESH_2026-06-27.md Copyright (c) 2026 Moritz Angermann <[email protected]>, Input Output Group. SPDX-License-Identifier: Apache-2.0
8-way parallel subsystem review (alloc/headers, vm.cc x2, primops, GC, compiler/lowering, FFI/caching, hygiene sweep) with all headline findings hand-verified against the working tree. Complements the 2026-06 lever campaigns: those measured strategies; this read the code. Headlines (all verified): - Every benchmark to date measured an instrumented build (v3_release=false everywhere + mutex/string/hash-map bump per primop call that bypasses even v3_release; limits env vars flip the per-op slow gate). - Thunk churn largely explained: one wrapper thunk per formal per call, call-arg de-thunking never runs on imports (~100% of nixpkgs), eager or-defaults, inherit-in-rec wrappers. Disjoint from the killed NixOS#135. - Chain-Bindings SELECT bypasses the inline cache entirely; MapAttrs parent-layer entries recomputed on every access. - Default config cannot reclaim dead tenured cells by construction (cellMetaEnabled=false -> sweep breaks at first block) while gen-major still pays full mark + clears every CU IC per fire. - Two correctness bugs: branch opcodes accept non-bool conditions (verified: `if 1 then a else b` evaluates; `1 && x` returns x) and primSort missing its listPostConstructBarrier (PhD-6 UAF class). Includes priority matrix P0-P6 with pre-committed falsifiers; P0 is re-baseline after de-instrumentation. Rule 0: kills the hypothesis "the remaining v3-vs-TW gap is purely structural with no fixable code-level defects" — the defect inventory (instrumented baseline, IC-less chain lookups, per-formal wrapper thunks, un-run strictness on imports) is concrete and falsifiable per item.
To do a multi-user Nix installation on regular Linux distros, one detail is missing. The gcroots and profile directories need the right permissions. Without it per-user profiles cannot be created.
Furthermore, I've created a profile.d script containing all stuff needed for multi-user Nix installation (ported from NixOS), as the original nix.sh is missing quite a lot.
I've also created an init.d script for starting and stopping the nix-daemon.
More info about my findings: http://sandervanderburg.blogspot.com/2013/06/setting-up-multi-user-nix-installation.html
I don't know yet if nix.sh and nix-multiuser.sh should both be installed. Maybe we can implement a configure switch for this, or merge nix.sh with nix-multiuser.sh. I need some feedback on this.