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

Optional requiredFeatures: suggestedFeatures that only improve remote scheduling #8316

Open
roberth opened this issue May 11, 2023 · 3 comments
Labels
feature Feature request or proposal idea approved The given proposal has been discussed and approved by the Nix team. An implementation is welcome. scheduling

Comments

@roberth
Copy link
Member

roberth commented May 11, 2023

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

Some features are not technically required, but should be scheduled on a machine with the feature for performance or other reasons.

For instance kvm speeds up the construction of images with a file system on it, but the build process also works when kvm is not available.

This does add entropy to the assumed build environment, which is not great.

Describe the solution you'd like

A new attribute suggestedFeatures that only improves remote scheduling.

If a machine with the listed features is available, schedule it there.
If such a machine is not available, build it wherever.

Describe alternatives you've considered

Remove the kvm flag from such builds.
This will likely slow down builds on build farms with mixed features. For instance, it may consist of bare metal machines with kvm that handle VM stuff and base load, plus autoscaled VMs to handle regular builds and peak load. VMs generally don't support nested virtualization, so kvm builds should not be scheduled onto them.

Additional context

Priorities

Add 👍 to issues you find important.

@roberth roberth added the feature Feature request or proposal label May 11, 2023
@Rosuavio
Copy link

Rosuavio commented May 11, 2023

Tl;dr
I think this is a great idea

Currently nix-install-action's repo recommends telling nix that the system supports kvm when it does not in order to get nixos tests to work on hosts like GitHub actions.

https://github.com/cachix/install-nix-action/tree/35806937f12c927d9c7223431c7261e2eb2a33ef#how-do-i-run-nixos-tests

I personally had to learn a lot more about GitHub actions, system features and nix configuration, then I wanted to understand why custom nixos tests were not building on GitHub when they did on my machine.

After I figured all of this out, it seemed like this is a known paper cut that everyone has been dealing with (according to my interpretation of the situation)

I think this change could help make the NixOS testing infra inside nixpkgs a lot more usable outside of nixpkgs for a common set of users (people using GitHub actions).

Also I worry that the current solution to this problem (recommending users tell nix that the system supports features it does not support) could lead to other errors when it is actually needed.

Rosuavio added a commit to Rosuavio/system-configs that referenced this issue May 11, 2023
NixOS test currently requires the "kvm" system feature flag, but the
GitHub actions runners don't enable kvm support. Interestingly the nixos
tests still run on systems without kvm support, but they do run slower.
As this kvm support is not necessary and saying that it is available
when it is not does not seem to cause any adverse effects, this is a
tolerable solution at this time.

For more context see: NixOS/nix#8316
Rosuavio added a commit to Rosuavio/system-configs that referenced this issue May 11, 2023
NixOS test currently requires the "kvm" system feature flag, but the
GitHub actions runners don't enable kvm support. Interestingly the nixos
tests still run on systems without kvm support, but they do run slower.
As this kvm support is not necessary and saying that it is available
when it is not does not seem to cause any adverse effects, this is a
tolerable solution at this time.

For more context see: NixOS/nix#8316
@thufschmitt thufschmitt added the idea approved The given proposal has been discussed and approved by the Nix team. An implementation is welcome. label Jul 28, 2023
@thufschmitt
Copy link
Member

Discussed during the Nix team meeting. Approved the idea, contributions welcome :)

Discussion log
  • @thufschmitt: Maybe redesign how we schedule things?
  • @roberth: What needs to be added?
  • @thufschmitt: The implementation of scheduling and remote scheduling should be redone
  • @roberth: That seems like an implementation level concern, not an addition to the derivation format
  • @edolstra: Do we have more use cases than kvm?
  • @thufschmitt: big-parallel
  • @edolstra: KVM may be a bad example because with support the build tends to time out
  • @ericson2315: Maybe it should be a map where the values says whether is required or suggested
  • @thufschmitt: Bike shedding can be done later
  • Conclusion: idea approved

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/2023-07-24-nix-team-meeting-minutes-75/31112/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request or proposal idea approved The given proposal has been discussed and approved by the Nix team. An implementation is welcome. scheduling
Projects
None yet
Development

No branches or pull requests

4 participants