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

Build capability interface #10579

Open
roberth opened this issue Apr 21, 2024 · 1 comment
Open

Build capability interface #10579

roberth opened this issue Apr 21, 2024 · 1 comment
Labels
feature Feature request or proposal remote build The SSH store, ssh:, ssh-ng:, ... (split from protocol label 2024-07) scheduling settings Settings, global flags, nix.conf significant Novel ideas, large API changes, notable refactorings, issues with RFC potential, etc. store Issues and pull requests concerning the Nix store

Comments

@roberth
Copy link
Member

roberth commented Apr 21, 2024

Is your feature request related to a problem? Please describe.

Scheduling a derivation involves a comparison between a derivation's scheduling attributes (such as system and requiredFeatures), and the related properties of a "builder" (such as system, extra-platforms, supportedFeatures, mandatoryFeatures).

In #9899 I have done some exploratory coding to work out these concepts a little better.

Problems:

  • "builder" is overloaded. It occurs in the derivation builder attribute, as well as "remote builder", which have very different meanings, yet interact too closely.
  • the remote builder configuration is denormalized, which users don't expect, resulting in inaccurate remote builder configs
    • specifically, remote builders and build capabilities are in a one to many relationship
    • by denormalizing the config (repeating the remote builder connection part), connection reuse becomes less efficient
  • we don't have a good interface to stub out builds in unit tests
    • this leads to more configuration than desired (Run unit tests with clean config #10562)
    • unit test performance is slightly worse, for having to perform an actual build (an easily bearable cost, considering our current over-reliance on functional tests)
  • we don't have an interface to separate the store component from the builder component, whether that's an internal or IPC interface
    • local and remote builds feel like chaotic reimplementations of each other because we lack the clarity of such an interface
    • nix-daemon has to manage builds instead of just a store and a build capability trust relation

Describe the solution you'd like

  1. Define unambiguous terminology
    • I've renamed "builder" to "build capability" but maybe someone has a better term?
    • We should probably further distinguish between "build capability" and the concrete service or implementation that fulfills that capability, because these are again in a many to many relation.
  2. Define interface in C++.
  3. Define an IPC interface between nix-daemon and build process or build daemon (or whatever we want to call it).

Describe alternatives you've considered

Additional context

Efforts/ideas to add more "systems" which may or may not be the native system.

Priorities

Add 👍 to issues you find important.

@roberth roberth added feature Feature request or proposal store Issues and pull requests concerning the Nix store labels Apr 21, 2024
roberth added a commit to edolstra/nix that referenced this issue Apr 21, 2024
Fixed in NixOS#10562

Building in unit tests should perhaps be kept to a minimum, but I have to note:

* single derivations are pretty fast to build
* we need to be able to build in various environment for the functional tests anyway
* this was the only way to test that part of the C API
* mocking only works if you have exceptionally good interfaces and the mocking code is reviewed over and over, if it works at all

For what it's worth, I think we can have an "exceptionally good interface",
in the form of NixOS#10579
Until that's been worked out, these cheap builds are fine to run in unit tests.
@roberth roberth added scheduling significant Novel ideas, large API changes, notable refactorings, issues with RFC potential, etc. settings Settings, global flags, nix.conf labels Apr 21, 2024
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2024-04-22-nix-team-meeting-minutes-140/44016/1

@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
feature Feature request or proposal remote build The SSH store, ssh:, ssh-ng:, ... (split from protocol label 2024-07) scheduling settings Settings, global flags, nix.conf significant Novel ideas, large API changes, notable refactorings, issues with RFC potential, etc. store Issues and pull requests concerning the Nix store
Projects
None yet
Development

No branches or pull requests

2 participants