Description
Is your feature request related to a problem? Please describe.
Nixpkgs now has a darwin.builder
package, which is a NixOS VM that's pre-built by Hydra, so that macOS users can create their first linux builder VM using it.
However, this still requires user intervention, and it is not enabled by default, nor should it be, because a VM has non-trivial overhead. Yet, there's something Nix can do to help.
Furthermore, other startable resources that are not a VM could provide a store.
Describe the solution you'd like
A configuration similar to remote builders, but for local VM builders.
What needs to be configured
- Command that starts the VM
- Port where the VM's sshd can be reached is printed to stdout when the port is available
- Command for shutting down the VM
- The scheduling related parameters, like max concurrent builds, supported features, mandatory features
Ideally the scheduler is aware that it's the same machine and it applies the "rule" vm.concurrentBuildLimit = min(host.jobs, vm.jobs)
The start stop start cycle is managed by a new store called LifeCycleStore
that returns and/or delegates to whatever store URI/config is returned from the configured start hook. The state of the resource (including store URI of the store to delegate to and shutdown command) is stored centrally, ideally managed by the nix daemon - LocalStore
.
A nix.conf
with builder VMs can be generated by configuration management tools such as nix-darwin and NixOS; perhaps even the official installer?
This also makes Nix useful at an earlier stage of the porting process:
- the VM does not need an evaluator
- the host does not need a sandbox
Example:
- effort: port the evaluator to Windows
- use case: get a nice UI for Linux packaging on Windows
Describe alternatives you've considered
Start a VM per build. This would be slow, especially for fine grained builds.
Status quo: user configures the VM, starts the VM, wasting their time and their system's memory
Additional context
Priorities
Add 👍 to issues you find important.