Skip to content

Fixes required to get nix working properly on Fedora - #25

Closed
michel-slm wants to merge 6 commits into
NixOS:masterfrom
michel-slm:fix-spec
Closed

michel-slm wants to merge 6 commits into
NixOS:masterfrom
michel-slm:fix-spec

Conversation

@michel-slm

Copy link
Copy Markdown
Contributor

These commits reorganize the spec file and update the Nix profile script to make Nix usable out-of-the-box.

Michel Alexandre Salim added 4 commits May 27, 2012 16:41
  older RPM versions
- move tests to dedicated %check section
- use standard build macros
- incorporate NixOS's configuration so that nix is usable by normal
  users
- install as a data file, not a program file
- Fix license field
- Split into subpackages
- Update build dependencies
- Configure users and groups for multi-user mode
- Fix installation location of Perl modules
@michel-slm

Copy link
Copy Markdown
Contributor Author

note: the following changes are still forthcoming:

  • service definition for Nix worker
  • splitting Emacs nix-mode into nix-mode itself and nix-mode-init, so that users don't have to load the entire nix-mode unless they are editing Nix expressions
  • version bump

@michel-slm

Copy link
Copy Markdown
Contributor Author

Service definition added.

Comment thread misc/systemd/nix-worker.service Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two lines should be removed.

Also, nix-worker.service should be added to EXTRA_DIST in Makefile.am. Otherwise the RPM can't be built from a source tarball.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in latest commit. I forgot to take out the commented lines, apologies..

- remove commented-out lines
- register the file for distribution in Makefile.am
@edolstra

Copy link
Copy Markdown
Member

Applied it, thanks!

@edolstra edolstra closed this May 31, 2012
edolstra added a commit that referenced this pull request Apr 25, 2017
fix nix-repl compilation after we don't have a global store variable anymore
meditans referenced this pull request in Ericson2314/nix Aug 28, 2020
zolodev pushed a commit to zolodev/nix that referenced this pull request Jan 1, 2024
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request Apr 20, 2026
Addresses the test-drift patterns catalogued at
`src/libexpr-tests/eval-trace/CLAUDE.md §N` (audit 2026-04-19).
Each §N.x below has its full analysis + fix shape documented in
that file; this is the mechanical resolution.

§N.1 — per-expression fingerprint mixing in TraceCacheFixture
  The 2-arg `makeCache(nixExpr, …)` now derives
  `perExprFp = SHA256(testFingerprint || ":" || nixExpr)` so
  distinct expressions land at distinct `(session_key,
  AttrPathId(0))` slots — mirroring production's
  `FileEvalExpressionHash` session-key derivation. The fixture
  tracks `lastPerExprFingerprint_` for `MaterializationDepTest::
  makeQueryDb()` and `dep-correctness.cc::collectAllStoredDeps`
  to bootstrap their query TraceStore at the same slot the
  record path used. `BuiltinsToFile_ContentChange_Invalidation`
  flipped from `EXPECT_EQ(calls, 0)` to `EXPECT_EQ(calls, 1)` —
  the OR-1 test-level reproducer was a fixture artifact, now
  closed.

§N.2 — simulateNewSession clears evalFile memo tables
  New `EvalState::clearCrossSessionCaches()` (public, narrower
  than `resetFileCache()`: preserves `positions` and `traceCtx`)
  clears `fileTraceCache` + `importResolutionCache` + `inputCache`
  — the three cross-session memos a real subprocess boundary
  starts empty. `simulateNewSession()` now calls it.

§N.3 — explicit loaderCalls assertions in cold→warm TEST_F tests
  `COLD_WARM_TEST` macro now auto-asserts `EXPECT_EQ(loaderCalls,
  0)` on the warm call (using the 2-arg fixture overload so §N.1
  mixing matches cold + warm). Hand-rolled sites in `store/cache
  .cc`, `verify/integration.cc`, and 8 materialization files got
  explicit assertions. One materialization test renamed to
  `CrossScope_AttrNames_ValueChanged_TopLevelReEval_SymmetryGap`
  pinning a top-level-vs-nested precision asymmetry (TODO:
  DEF-3).

§N.4 — migrate RC property tests from loaderCalls to counter-delta
  70 property tests across 35 files: `RC_ASSERT(loaderCalls ==
  0)` → `RC_ASSERT(snap.primaryCacheServedOnly())`;
  `RC_ASSERT(loaderCalls == 1)` →
  `RC_ASSERT(snap.deltaTraceCacheMisses() >= 1)`. Case D
  "recovery expected" tests assert `deltaTraceCacheHits >= 1`
  (any cached path acceptable; value-equality is the real
  correctness check). Case E "loader re-ran OR recovery" tests
  use `deltaTraceCacheMisses + deltaRecoveryAttempts >= 1`.
  Closes the hazard where `loaderCalls == 0` accepted
  History-bootstrap-served results under the shared-fixture RC
  model.

§N.5 — concurrent-eval.cc: counter-delta + §N.1 isolation note
  Updated `InterleavedExpressions_NoCrossContamination` to
  reflect that §N.1 mixing gives `exprA`, `exprB` distinct
  session slots; the pre-§N.1 shared-fingerprint hazard is no
  longer exercised by this call shape. Strengthened via
  `primaryCacheServedOnly()`.

§N.6 — citation corrections + C-7 recovery strengthening
  Corrected §N.6 citations in `src/libexpr-tests/eval-trace/
  CLAUDE.md`. The three `Recovery_*_NoThrow` tests at
  `recovery.cc:1009/1053/1093` stay as ENT (intrinsically miss-
  path — documented at DEF-1). C-7
  `Recovery_StructVariantDep_Subsumes_StructuralDeps_
  WhenFileVerified` strengthened from `EXPECT_NO_THROW` to
  `ASSERT_TRUE(has_value())` + `assertCachedResultEquals(v1)`
  — structural variant recovery verifies correctly.

§N.7 — unit-level OR-5 reproducer via orchestrator scanHistory
  `Integration_OR5Reproducer_ScanHistoryServesCrossSession` in
  `verify/integration.cc`: two `TraceSession` instances with
  distinct `semanticSessionKey` but the same `stableRecoveryKey`,
  exercising `verification-orchestrator.cc`'s scanHistory
  bootstrap through the full async path. Complements the
  functional Test 25 in `eval-trace-deps.sh`.
  `PrimaryCacheServedOnly_RejectsHistoryBootstrap` is the
  companion demonstrating that `primaryCacheServedOnly()`
  correctly rejects history-bootstrap serves, which the
  pre-§N.4 shape (`deltaTraceCacheHits >= 1 &&
  deltaRecoveryAttempts == 0`) would spuriously accept.

§N.8 — PathCountersSnapshot helper
  RAII snapshot of eval-trace observability counters in
  `helpers.hh`. `delta*()` accessors return change since
  construction. `primaryCacheServedOnly()` convenience forbids
  history-bootstrap AND recovery serves.

§N.9 — clearStoreIndex call-sites in volatile.sh + output.sh
  Both files now call `clearStoreIndex` at the start of each
  test case. `clearStoreIndex` itself was hoisted to
  `tests/functional/common/functions.sh` in a prior commit.

Also addresses adversarial-review follow-ups:
- B1/M1 counter plumbing was in a prior commit (increment fires
  only after `verified && bootstrappedFromHistory`).
- M-2/M-3: new `PrimaryCacheServedOnly_RejectsHistoryBootstrap`
  test demonstrates the tightened guard catches a real hazard.
- m-1/m-3: `makeCacheWithSessionConfig` helper removes boilerplate
  from N.7 tests; `bootstrapSeed` variable renamed from
  `dbFingerprint` (doesn't select the DB file).
- m-4: Case E semantic change documented inline in sort.cc/filter.cc.
- m-5: `KNOWN_MISS` suffix replaced with `_SymmetryGap`.
- NixOS#24 demonstration test added.
- NixOS#25: `clearCrossSessionCaches` now clears `inputCache` too.

Doc updates:
- New Section D (Deferred Work Index) in
  `src/libexpr-tests/eval-trace/CLAUDE.md` with DEF-1..DEF-7
  pointers.
- OR-5 regression-tests subsection in
  `src/libexpr/eval-trace/CLAUDE.md` now lists the unit-level
  reproducers alongside functional Test 25.
- OR-10 restructured: "Resolved 2026-04-20" section for items
  addressed by §N.1–§N.9; "Still unaddressed" section for
  concrete remaining work.
- `property/CLAUDE.md` fixture-pattern item 8 rewritten to
  document the four counter-delta assertion shapes (A/B/D/E).
- `src/libexpr/eval-trace/CLAUDE.md` OR-N intro now points at §D.

Verified: `nix build .#checks.aarch64-darwin.nix-expr-tests-run`
and `.#checks.aarch64-darwin.nix-functional-tests` both green.
Benchmark: hot/6 vs reference/cold/6 over 25 commits shows 100%
soundness (25/25 PASS), 100% cache hit rate, no performance
regression vs prior hot runs.

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

Records candidates that landed in this session across four shards;
the libexpr shard already shipped its own doc commit in 43ebd1d.

libfetchers:
  - NixOS#51  -- delete-and-trim github.cc tree-hash scaffolding; trim
            scope expanded past the two #if 0 blocks to also drop
            RefInfo::treeHash, the upstreamTreeHash helper, and the
            treeHash slot in GitArchiveInputScheme::allowedAttrs.
  - NixOS#70  -- close as resolved-by-upstream; commit de6b5f6 (Eelco
            Dolstra, 2025-12-10) extracted makeSourcePathToHashCacheKey
            ahead of the catalog snapshot.

libflake:
  - NixOS#78  -- forEachReachableNode helper covers two of three DFS
            sites (isUnlocked, getAllInputs); doFind excluded as
            structurally different (name-based path-walk via
            follows, InputAttrPath-keyed visited set, throws cycle
            path on revisit).

libutil:
  - NixOS#37  -- fso::descendPath<V> helper covers NarAccessorImpl::find
            only; MemorySourceAccessor::open and
            NarIndexer::createMember excluded after Rule-6 walks
            (one's symlink-rejection policy, the other's amortized
            O(1) parent-stack).
  - NixOS#163 -- additive PipeOptions overload alongside the asymmetric
            originals; replacing the originals would be a
            source-compat break in a shipped header.

nix-cli:
  - NixOS#25  -- reclassify as effectively unimplementable; the
            preprocessor rejects #include directives inside macro
            argument lists, so NIX_COMMAND_DOC("name") with embedded
            #include cannot work.  Effort bumped from trivial to
            medium pending a different mechanism.
  - NixOS#72  -- prependFlakeAttrPaths free helpers; mixin form failed
            on diamond inheritance (SourceExprCommand non-virtually
            inherited via InstallableCommand/InstallableValueCommand).
            Three sites converted; CmdSearch and MixFormatter
            intentionally retain direct overrides.
  - NixOS#74  -- runWholeStoreGC header-only helper across three sites,
            preserving the print-roots branch and the action-aware
            printer.
  - NixOS#75  -- runNarDump header-only template across three sites,
            preserving the legacy "no TTY check" path via a
            checkTTY parameter.
  - NixOS#93  -- three of four NixMultiCommand parents converted to
            getCommandsFor + per-child NIX_REGISTER_COMMAND; CmdHash
            deferred per the candidate.
  - NixOS#141 -- per-command static-ify subset only (deleteOlderThan,
            dryRun in nix-collect-garbage.cc); the candidate's
            nix-instantiate.cc gcRoot/rootNr targets had already
            been folded into a static GcRootNamer.

STATUS.md "Cleanup branches (live)" updated for all five shards
(including libexpr) with new addresses and Local-only tip notes.

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

Three parallel investigations after Layer 2a (d77ef96), all code-grounded; outcomes recorded in
redesign-plan follow-up NixOS#25 and the two review fixes applied:

(A) Aggressive edge-recorder design: a research probe REPRODUCED the revert leak end-to-end (then
reverted). Key correction — the RFC §2 prose is wrong: the reverted shape lost a PRODUCER-INTRINSIC
readFile-in-args dep (folds into drvPath), not consumer-incidental deps. Route-by-drvPath/verify-by-
trace_hash closes it. Identified the RFC's under-specified soundness-critical site (the COLD
first-consumer edge — only the replay gate emits today, the cold forcer never hits it) and a cheaper
hot structure (epoch-range filter instead of a per-derivation sub-scope).

(B) Hot net-cost measurement: ran a real teardown-inclusive WALL A/B (§3b no-§3b/no-defer/defer).
COLD: Layer 1+2a recovers 84.6% of the §3b cold record overhead (B 9.83s → C 7.17s, −27.1%). HOT:
defer barely helps (−7%) — empirically confirms the 18-19× hot regression is materialize-time
re-execution, a separate mechanism Layer 1/2a does not address. M re-measured ≈ 1. Net: cold likely
positive; hot LOW confidence (the real risk the aggressive shape must beat is unbuilt + unmeasured).

(C) Independent Layer 2a adversarial review: VERDICT sound, no blockers. Traced every
publishStateChange caller — none re-opens the inversion. Three minor findings addressed:
- F1: preserved the SIGKILL crash harness as a reproducible experiment
  (benchmarks/eval-trace-bench/experiments/layer2a-crash-consistency.sh, with the L1-alone-vs-L2a
  non-vacuity contrast via REBUILD_L1_ALONE=1) + README row. Recorded recommendation to promote it to
  a committed test before the aggressive shape flips the gate.
- F2: corrected an overstated comment (sqlite-trace-storage.cc + .hh) — capturing session/recovery
  keys at buffer time is DEFENSIVE, not a soundness requirement: both derive from the
  SetOnce<SessionConfig> fixed at session open, so capture-at-buffer == read-at-drain. Comment-only.
- F3: a transient research probe the reviewer saw mid-run was cleaned up; tree confirmed pristine.

Source edits are comment-only (verified: no logic change). 26/26 + 420/422 eval-trace tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
edolstra added a commit that referenced this pull request Jun 16, 2026
I encountered this failure during a test:

  $ nix-instantiate --store /tmp/nix-gc-test '<nixpkgs>' -A hello --add-root x --auto-optimise-store
  error: stack overflow (possible infinite recursion)

This turned out to be due to the recursion in optimisePath_() when called from a coroutine (which has a small stack):

  #0  0x00007ffff7e3e45d in nix::drainFD (fd=0, sink=..., opts=...) at ../src/libutil/file-descriptor.cc:131
  #1  0x00007ffff7ee6369 in nix::PosixSourceAccessor::readFile (this=0x55555617e2d0, path=..., sink=..., sizeCallback=...) at ../src/libutil/posix-source-accessor.cc:66
  #2  0x00007ffff7d38ad5 in nix::SourceAccessor::dumpPath(nix::CanonPath const&, nix::Sink&, nix::fun<bool (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>&)::$_0::operator()(nix::CanonPath const&) const (this=0x7fffa7d64978, path=...) at ../src/libutil/archive.cc:48
  #3  0x00007ffff7d36efc in nix::SourceAccessor::dumpPath(nix::CanonPath const&, nix::Sink&, nix::fun<bool (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>&)::$_1::operator()<$_1>(this $_1 const&, nix::CanonPath const&, unsigned long) (dump=..., path=..., depth=0) at ../src/libutil/archive.cc:72
  #4  0x00007ffff7d36bec in nix::SourceAccessor::dumpPath (this=0x55555617e310, path=..., sink=..., filter=...) at ../src/libutil/archive.cc:58
  #5  0x00007ffff7f1e3fa in nix::SourcePath::dumpPath (this=0x7fffa7d65f90, sink=..., filter=...) at ../src/libutil/source-path.cc:49
  #6  0x00007ffff7e3cb85 in nix::dumpPath (path=..., sink=..., method=nix::FileSerialisationMethod::NixArchive, filter=...) at ../src/libutil/file-content-address.cc:73
  #7  0x00007ffff7e3ccbd in nix::hashPath (path=..., method=nix::FileSerialisationMethod::NixArchive, ha=nix::HashAlgorithm::SHA256, filter=...) at ../src/libutil/file-content-address.cc:93
  #8  0x00007ffff763f02f in nix::LocalStore::optimisePath_ (this=0x555555eaeb00, act=0x0, stats=..., path=Python Exception <class 'gdb.error'>: No type named std::filesystem::__cxx11::path::_Cmpt.

      filesystem::path "/tmp/nix-gc-test/nix/store/9figz32vbiblaw5x3li1hc8q9qwlwf27-source/pkgs/desktops/pantheon/libraries/granite/7/default.nix", inodeHash=..., repair=nix::NoRepair)
      at ../src/libstore/optimise-store.cc:162
  #9  0x00007ffff763e70b in nix::LocalStore::optimisePath_ (this=0x555555eaeb00, act=0x0, stats=..., path=Python Exception <class 'gdb.error'>: No type named std::filesystem::__cxx11::path::_Cmpt.

      filesystem::path "/tmp/nix-gc-test/nix/store/9figz32vbiblaw5x3li1hc8q9qwlwf27-source/pkgs/desktops/pantheon/libraries/granite/7", inodeHash=..., repair=nix::NoRepair)
      at ../src/libstore/optimise-store.cc:125
  ...
  #25 0x00007ffff7f058ad in nix::sourceToSink(nix::fun<void (nix::Source&)>)::SourceToSink::operator()(std::basic_string_view<char, std::char_traits<char> >)::{lambda(boost::coroutines2::detail::pull_coroutine<bool>&)#1}::operator()(boost::coroutines2::detail::pull_coroutine<bool>&) const (this=0x7fffa7d73c98, yield=...) at ../src/libutil/serialise.cc:361
  ...
  #32 0x00007ffff3af918f in make_fcontext () from /nix/store/5xkyx9gi1s8mqp1ki1hsx8hwpr4dncxk-boost-1.87.0/lib/libboost_context.so.1.87.0

So let's make optimisePath_() non-recursive to ensure constant stack space.

Co-Authored-By: Claude Opus 4.8 (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.

2 participants