1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-18 08:19:35 +01:00
nix/src/libstore/unix/build
John Ericson f81c06accf Gut LocalDerivationGoal::tryLocalBuild
Now, most of it is in two new functions:
`LocalDerivationGoal::{,un}repareBuild`.

This might seems like a step backwards from coroutines --- now we have
more functions, and are stuck with class vars --- but I don't think it
needs to be.

There's a few options here:

- (Re)introduce coroutines for the isolated building logic. We could use the
  same coroutines types, or simpler ones specialized to this use-case.
  The `tryLocalBuild` caller can still use `Goal::Co`, and just will
  manually "pump" this inner coroutine.

- Return closures from each step. This is sort of like coroutines by
  hand, but it still allows us to stop writing down the local variables
  in each type.

  Being able to fully-use RAII again would be very nice!

- Keep top-level first-order functions like now, but make more
  functional. Instead of having one state object (`DerivationBuilder`)
  for all steps (setup, run, teardown), we can have separate structs for
  the live variables at each point we consume and return.

  This at least avoids "are these variables active at this time?"
  questions, but doesn't give us the full benefit of RAII as we must
  manually ensure FIFO create/destroy orders still.

One thing to note is that by keeping the `outputLock` unlocking in
`tryLocalBuild`, we are arguably uncovering a rebuild scheduling vs
building distinction, as the output locks are pretty squarely a
scheduling concern. It's nice that the builder doesn't need to know
about them at all.
2025-04-16 17:39:45 -04:00
..
child.cc Expose the nix component in header include paths 2025-04-01 11:40:42 -04:00
hook-instance.cc Expose the nix component in header include paths 2025-04-01 11:40:42 -04:00
local-derivation-goal.cc Gut LocalDerivationGoal::tryLocalBuild 2025-04-16 17:39:45 -04:00
sandbox-defaults.sb libstore: fix port binding in __darwinAllowLocalNetworking sandbox 2024-08-08 14:31:26 -04:00
sandbox-minimal.sb Build a minimized Nix with MinGW 2024-04-17 12:26:10 -04:00
sandbox-network.sb Build a minimized Nix with MinGW 2024-04-17 12:26:10 -04:00