Skip to content

Conversation

Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented Sep 3, 2025

Motivation

The first few commits of #13865 before the goto that would be controversial.

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

Do this with a new `useHook` boolean we carefully make sure is set in
all cases. This change isn't really worthwhile by itself, but it allows
us to make further refactors (see later commits) which are
well-motivated.
This will make it easier to convert somethings to RAII.
It doesn't need to be a field any more, because we just use it with two
loops.
We don't need to keep doing this every loop iteration, hook stuff it is only set
above.
@Mic92 Mic92 requested a review from Copilot September 3, 2025 20:57
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the derivation building goal to simplify the control flow by eliminating the controversial goto statement, consolidating the hook and local build paths into a single function flow.

  • Inlines the hookDone() coroutine and started() function into the main tryToBuild() flow
  • Moves hook machine name tracking from the goal to the HookInstance struct
  • Converts the hook build path from a separate coroutine to inline logic with a loop structure

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/libstore/unix/include/nix/store/build/hook-instance.hh Adds documentation and machineName field to HookInstance struct
src/libstore/include/nix/store/build/derivation-building-goal.hh Removes hook-related member variables and methods, moves constructor/destructor to public
src/libstore/build/derivation-building-goal.cc Refactors tryToBuild() to inline hook logic, removes separate hookDone() coroutine

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Exactly why is is correct is a little subtle, because sometimes the
worker is owned by the worker. But the commit message in
e437b08 explained the situation well
enough: I made that commit message part of the ABI docs, and now it
should be understandable to the next person.
…`tryToBuild`

Will help us make this a local variable.
Also inline `assertPathValidity` in the process.
@Ericson2314 Ericson2314 force-pushed the derivation-building-goal-simplify-0 branch from 5de69f7 to a30bf96 Compare September 3, 2025 21:04
@Ericson2314 Ericson2314 merged commit b69576e into NixOS:master Sep 3, 2025
14 checks passed
@Ericson2314 Ericson2314 deleted the derivation-building-goal-simplify-0 branch September 3, 2025 21:36
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