Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move build loop into the client #5056

Open
edolstra opened this issue Jul 27, 2021 · 6 comments
Open

Move build loop into the client #5056

edolstra opened this issue Jul 27, 2021 · 6 comments
Labels
remote build The SSH store, ssh:, ssh-ng:, ... (split from protocol label 2024-07)

Comments

@edolstra
Copy link
Member

Currently, when using the Nix daemon, the whole dependency graph machinery (i.e. Worker, DerivationGoal etc.) is done in the daemon. However, this doesn't work well with --eval-store(#5025) since the daemon doesn't have access to the eval store used by the client. It also doesn't allow fixed-output derivations to be run in the context of the client (where it has access to stuff like SSH keys forfetchGit`).

So we should move the build logic into the client. Worker already has been generalized to work on any Store, so the main remaining change is to have DerivationGoal and SubstitutionGoal call the daemon to do the actual build/substitution.

@Ericson2314
Copy link
Member

I hope this be done in a way to improve remote builders more generally? e.g. one can already do nix-build --store local --builders 'auto - - 1 1'

Per #5025 (comment) it sounds like you had similar thoughts. I hope we can do just that!

@Ericson2314
Copy link
Member

Also, I hope this doesn't need to be mandatory? E.g. if I am using a big build farm, I do want the build farms to do the scheduling.

I think being able to open "reverse" connections would help such that the remote store can use the client as a build remote for those fixed-output derivations / remote store for anything the client has already built.

@rickynils
Copy link
Member

@edolstra Can you clarify why "since the daemon doesn't have access to the eval store used by the client" is a problem? After evaluation, the client will copy all .drv files to the daemon, right?

Like @Ericson2314 I hope this would be an optional thing. For https://nixbuild.net, it is beneficial to just receive a big pile of .drv files that we can schedule to our own liking.

The idea about being able to open a reverse connection to the client, and use the client as an additional substituter sounds like a great way of solving the problem of fetching fixed outputs that needs SSH keys etc.

@Ericson2314
Copy link
Member

@rickynils Incidentally, I think the "reverse connection" use-case is the best concrete reason to switch to an off-the-shelf RPC protocol. You really want to multiplex streams to avoid bad liveness issues of traffic for requests in one way blocking the other, and stuff gets complex quick.

@rickynils
Copy link
Member

@Ericson2314 Yeah, I agree. Any ideas on how we can get started? :)

@Ericson2314
Copy link
Member

As I said on twitter to you :), first we must test more!

#5753 can be merged. #5754 needs to also be done, because #5753 needs to be backported and my backport ran into sneaky variable issues.

Perhaps you want to try seeing what's going wrong with #5754?

@stale stale bot added the stale label Nov 13, 2022
@stale stale bot removed the stale label Dec 5, 2022
Ericson2314 added a commit to obsidiansystems/nix that referenced this issue Apr 13, 2023
More progress on issue NixOS#5729

The method trivially generalizes to be store-implementation-agnostic, in
fact.

However, we force it to continue to be unimplemented with `RemoteStore`
and `LegacySSHStore` because the implementation we'd get via the
generalization is probably not the one users expect. This keeps our
hands untied to do it right going forward.

For more about the tension between the scheduler logic being
store-type-agnostic and remote stores doing their own scheduling, see
issues NixOS#5025 and NixOS#5056.
Ericson2314 added a commit to obsidiansystems/nix that referenced this issue Apr 14, 2023
More progress on issue NixOS#5729

The method trivially generalizes to be store-implementation-agnostic, in
fact.

However, we force it to continue to be unimplemented with `RemoteStore`
and `LegacySSHStore` because the implementation we'd get via the
generalization is probably not the one users expect. This keeps our
hands untied to do it right going forward.

For more about the tension between the scheduler logic being
store-type-agnostic and remote stores doing their own scheduling, see
issues NixOS#5025 and NixOS#5056.
@roberth roberth added the remote build The SSH store, ssh:, ssh-ng:, ... (split from protocol label 2024-07) label Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
remote build The SSH store, ssh:, ssh-ng:, ... (split from protocol label 2024-07)
Projects
None yet
Development

No branches or pull requests

5 participants