Skip to content

Sync with upstream 2.32.3#255

Merged
edolstra merged 32 commits intomainfrom
sync-2.32.3
Nov 7, 2025
Merged

Sync with upstream 2.32.3#255
edolstra merged 32 commits intomainfrom
sync-2.32.3

Conversation

@edolstra
Copy link
Collaborator

@edolstra edolstra commented Nov 7, 2025

Motivation

Also updates the nixpkgs lock.

Context

Summary by CodeRabbit

  • New Features

    • SSH IPv6 address support now handles zone identifiers properly.
  • Bug Fixes

    • Build verification mode (--check) now consistently runs post-build hooks.
    • Improved error handling for invalid flake references.
  • Chores

    • Version bumped to 2.32.3.
    • Updated minimum Boost dependency to 1.87.0.

juhp and others added 30 commits October 27, 2025 14:28
Since 2.32, nix now needs boost 1.87 or later to build,
due to using unordered::concurrent_flat_map try_emplace_and_cvisit

../src/libexpr/eval.cc: In member function ‘void nix::EvalState::evalFile(const nix::SourcePath&, nix::Value&, bool)’:
../src/libexpr/eval.cc:1096:20: error: ‘class boost::unordered::concurrent_flat_map<nix::SourcePath, nix::Value*, std::hash<nix::SourcePath>, std::equal_to<nix::SourcePath>, traceable_allocator<std::pair<const nix::SourcePath, nix::Value*> > >’ has no member named ‘try_emplace_and_cvisit’; did you mean ‘try_emplace_or_cvisit’?
 1096 |     fileEvalCache->try_emplace_and_cvisit(
      |                    ^~~~~~~~~~~~~~~~~~~~~~
      |                    try_emplace_or_cvisit

See boostorg/unordered@834580b

(cherry picked from commit f594a8e)
Instead of iterating over the newly built bindings we can
do a cheaper set_intersection to count duplicates or fall back
to a per-element binary search over the "base" bindings.

This speeds up `hello` evaluation by around 10ms (0.196s -> 0.187s) and
`nixos.closures.ec2.x86_64-linux` by 140ms (2.744s -> 2.609s).

This addresses a somewhat steep performance regression from 82315c3
that reduced memory requirements of attribute set merges. With this patch
we get back around to 2.31 level of eval performance while keeping the memory
usage optimization.

Also document the optimization a bit more.

(cherry picked from commit ec2fd2d)
…tenance

[Backport 2.32-maintenance] nix-2.32 needs boost-1.87+ for `try_emplace_and_cvisit`
…tenance

[Backport 2.32-maintenance] libexpr: Speed up BindingsBuilder::finishSizeIfNecessary
The `showBytes()` function was redundant with `renderSize()` as the
latter automatically selects the appropriate unit (KiB, MiB, GiB, etc.)
based on the value, whereas `showBytes()` always formatted as MiB
regardless of size.

Co-authored-by: Bernardo Meurer Costa <beme@anthropic.com>
(cherry picked from commit f234633)
…tenance

[Backport 2.32-maintenance] diff-closures: print sizes with dynamic unit
This will currently fail, until the bug is fixed.

Co-Authored-By: Sergei Zimmerman <sergei@zimmerman.foo>
(cherry picked from commit 246dbe1)
The test added in the previous commit now passes.

Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
(cherry picked from commit de19279)
Some zsh setups (including mine) do not load the
completion if `#compdef` is not on the first line.

So we move the `# shellcheck` comment to the
second line to avoid this issue.

(cherry picked from commit 956fffd)
…tenance

[Backport 2.32-maintenance] zsh/completion: put compdef on first line
…tenance

[Backport 2.32-maintenance] fix(libstore/build/derivation-goal): don't assert on partially valid outputs
…tenance

[Backport 2.32-maintenance] meson: Also split version string at '+' for Darwin
Accidentally broken in dbc235c.
Adds a bit of tests for this, even though this protocol is mostly deprecated
everywhere.

(cherry picked from commit ade3d5d)
…tenance

[Backport 2.32-maintenance] libfetchers: Restore plain git inputs recognition
This restores the pre-2.31 handling of ZoneID identifiers in store references.
It's the only place we reasonably care about this back-compat.

(cherry picked from commit 8dbc247)
…tenance

[Backport 2.32-maintenance] libstore: Improve store-reference back-compat with IPv6 ZoneId literals
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/d98ce345cdab58477ca61855540999c86577d19d?narHash=sha256-O2CIn7HjZwEGqBrwu9EU76zlmA5dbmna7jL1XUmAId8%3D' (2025-08-26)
  → 'github:NixOS/nixpkgs/daf6dc47aa4b44791372d6139ab7b25269184d55?narHash=sha256-wxX7u6D2rpkJLWkZ2E932SIvDJW8%2BON/0Yy8%2Ba5vsDU%3D' (2025-10-27)

(cherry picked from commit 233bd25)
(cherry picked from commit 81a2809)
…tenance

[Backport 2.32-maintenance] flake: Update, nixos-25.05-small -> nixos-25.05
The assumption that no unknown paths can be returned is incorrect. It
can happen if a derivation has outputs that are substitutable, but
that have references that cannot be substituted (i.e. an incomplete
closure in the binary cache). This can easily happen with
magic-nix-cache.

(cherry picked from commit a828cf7)
…tenance

[Backport 2.32-maintenance] nix flake check: Remove incorrect assertion
…tenance

[Backport 2.32-maintenance] Don't crash on flakerefs containing newlines
….32-maintenance"

This reverts commit 5c9481d,
reversing changes made to
291e8ab. This is a behaviour change
that should be avoided on maintenance branches.
Tagging release 2.32.3
@coderabbitai
Copy link

coderabbitai bot commented Nov 7, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • flake.lock is excluded by !**/*.lock

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This patch updates Nix to version 2.32.3, improving IPv6 store reference parsing with zone ID support, refining post-build hook invocation in check mode, adjusting build output handling, and bumping the Boost dependency requirement to 1.87.0.

Changes

Cohort / File(s) Summary
Version Bump
\.version
Updated version from 2.32.2 to 2.32.3
Build System
nix-meson-build-support/common/meson.build, src/libutil/meson.build
Modified version sanitization to handle plus signs by truncating at '+' before 'pre'; bumped Boost minimum requirement from 1.82.0 to 1.87.0
Documentation & Formatting
doc/manual/generate-store-types.nix, misc/zsh/completion.zsh
Reflowed readFile expression with parentheses; relocated shellcheck disable directive after compdef line
Attribute Set Layer Optimization
src/libexpr/include/nix/expr/attr-set.hh
Added Boost iterator header; implemented sophisticated duplicate-aware size calculation for layered Bindings using conditional set\_intersection or per-attribute lookup strategy
Flake Reference Parsing
src/libflake/flakeref.cc, src/libflake-tests/flakeref.cc, src/libfetchers/git.cc
Replaced assertion with runtime Error for invalid flake regex matches; added test cases for git URLs with refs; optimized GitInputScheme guard to short-circuit on non-git schemes
IPv6 Store Reference & Zone ID Handling
src/libstore/store-reference.cc, src/libstore-tests/store-reference.cc, src/libstore-tests/data/store-reference/ssh_unbracketed_ipv6_*.txt
Implemented back-compat for ZoneId parsing in unbracketed IPv6 authorities with percent-encoding normalization; added 6 new test data files and test fixtures covering bracketed/unbracketed IPv6 with zone IDs and edge cases
Build Output & Hook Handling
src/libstore/build/derivation-building-goal.cc, src/libstore/build/derivation-goal.cc
Modified check mode to use revalidated outputs instead of builtOutputs to ensure post-build hook invocation; added fallback to record missing expected outputs in builtOutputs
Functional Tests
tests/functional/build-hook-list-paths.sh, tests/functional/post-hook.sh
Added new hook script for collecting output paths; introduced conditional regression test for daemon 2.33.0pre20251029 validating post-build hook execution in check mode

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Build as DerivationBuildingGoal
    participant Check as checkPathValidity()
    participant Hook as Post-Build Hook

    User->>Build: tryToBuild() in bmCheck mode
    alt Old: bmCheck uses builtOutputs
        Build->>Hook: outputs from DerivationBuilder
        Note over Hook: Hook may be skipped if<br/>no new registrations
    else New: bmCheck uses revalidated outputs
        Build->>Check: checkPathValidity(initialOutputs)
        Check-->>Build: (knownOutputs, unknownOutputs)
        Build->>Build: Use unknownOutputs as source
        Build->>Hook: Known + validated outputs
        Note over Hook: Hook always invoked<br/>with revalidated set
    end
    Hook-->>User: Hook results in HOOK_DEST
Loading
sequenceDiagram
    participant Parser as StoreReference Parser
    participant IPv6 as IPv6 Detection
    participant Zone as Zone ID Handler

    Parser->>Parser: Receive unbracketed IPv6 authority
    Parser->>Parser: Strip brackets if present
    Parser->>Parser: Split at '%' delimiter
    alt Zone ID present
        Parser->>Zone: Extract zone indicator
        Parser->>IPv6: Parse IPv6 from pre-% substring
        IPv6-->>Zone: Parsed address
        Zone->>Zone: Percent-encode '%' as %25
        Zone-->>Parser: Rebuild: [IPv6%25zoneId]
    else No Zone ID
        Parser->>IPv6: Parse full authority as IPv6
        IPv6-->>Parser: Parsed address
    end
    Parser-->>Parser: Return normalized store reference
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Attribute set layer optimization (src/libexpr/include/nix/expr/attr-set.hh): Dense logic with conditional strategy selection (set\_intersection vs. per-attribute lookup) requires careful validation of correctness for duplicate counting.
  • IPv6 zone ID parsing (src/libstore/store-reference.cc): Back-compat handling with percent-encoding normalization logic demands careful tracing through bracketing, splitting, and reconstruction steps.
  • Build output handling changes (src/libstore/build/derivation-*.cc): Control flow modifications in check mode require understanding of original intent and post-build hook semantics to verify correctness.
  • Multiple test data files and fixtures (src/libstore-tests/data/store-reference/ssh_unbracketed_ipv6_*.txt, src/libstore-tests/store-reference.cc): Ensure test coverage comprehensively validates zone ID and percent-encoding edge cases.

Possibly related PRs

  • Parallel eval performance improvements #194: Refactors mutable Store/LocalStore state into separately allocated/synchronized objects and updates concurrent map handling, potentially overlapping with concurrent access patterns in new IPv6 parsing logic.
  • Sync with upstream 2.32.2 #242: Modifies the same .version file with version bumping, directly related to this PR's version update.

Suggested reviewers

  • cole-h

Poem

🐰 A version hops forward, from two-thirty-two,
IPv6 zones untangled, now parsing through,
Hooks dance in check mode, so graceful and bright,
Boost bounds grow tighter, all layers feel right!
Hippity-hoppity, tests all abound! 🎉

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Sync with upstream 2.32.3' accurately reflects the main change—a version bump from 2.32.2 to 2.32.3 across multiple files, with supporting infrastructure updates.

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Nov 7, 2025

@github-actions github-actions bot temporarily deployed to pull request November 7, 2025 10:28 Inactive
@edolstra edolstra added this pull request to the merge queue Nov 7, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 7, 2025
@edolstra edolstra enabled auto-merge November 7, 2025 20:09
@github-actions github-actions bot temporarily deployed to pull request November 7, 2025 20:14 Inactive
@github-actions github-actions bot temporarily deployed to pull request November 7, 2025 21:24 Inactive
@edolstra edolstra added this pull request to the merge queue Nov 7, 2025
Merged via the queue into main with commit 0dd456a Nov 7, 2025
34 checks passed
@edolstra edolstra deleted the sync-2.32.3 branch November 7, 2025 22:01
@coderabbitai coderabbitai bot mentioned this pull request Nov 11, 2025
@coderabbitai coderabbitai bot mentioned this pull request Feb 2, 2026
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.

9 participants