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

dxvm: experimental support for Devbox VMs #169

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

dxvm: experimental support for Devbox VMs #169

wants to merge 2 commits into from

Conversation

gcurtis
Copy link
Contributor

@gcurtis gcurtis commented Oct 3, 2023

This is a prototype for using the macOS Virtualization Framework to launch Linux VMs on macOS.

The dxvm command acts like devbox shell except that it launches the Devbox
environment in a VM.

To create a new VM, run the following:

cd ~/my/project
dxvm -install

After the VM is bootstrapped, you can launch it any time with:

cd ~/my/project
dxvm

See the README.md for details.

Changelog

10/16/23

  • Rosetta is enabled on aarch64-darwin. This allows VMs to transparently run aarch64 and x86_64 Linux binaries simultaneously.
    • Install x86_64 binaries with Nix using the --system flag. For example, nix profile install --system x86_64 <pkg>.
  • The current Devbox project directory is now automatically detected and mounted. It can be found in ~/devbox in the VM.
  • Devbox is automatically installed when the VM is created using the github:jetpack-io/devbox?ref=gcurtis/flake flake.
  • Starting a VM is now completely silent. The kernel's console is sent to .devbox/vm/console instead of stdout so that the first thing the user sees is their own shell prompt.
    • This work really well when launching a paused VM. If the VM resumes fast enough, it feels like using a normal shell.
  • Bootstrapping from an NixOS installer ISO with the -install flag is now fully automated. This is done by reading/writing to the VM's console using a pipe (similar to a program like expect).
  • Fixed a bug where stopping the VM would always return an error.

This is a prototype for using the macOS Virtualization Framework to
launch Linux VMs on macOS. See the README.md for details.
A bunch of new miscellaneous new features and improvements:

- Rosetta is enabled on `aarch64-darwin`. This allows VMs to
  transparently run aarch64 and x86_64 Linux binaries simultaneously.
	- Install x86_64 binaries with Nix using the `--system` flag.
	  For example, `nix profile install --system x86_64 <pkg>`.
- The current Devbox project directory is now automatically detected and
  mounted. It can be found in `~/devbox` in the VM.
- Devbox is automatically installed when the VM is created using the
  `github:jetpack-io/devbox?ref=gcurtis/flake` flake.
- Starting a VM is now completely silent. The kernel's console is sent
  to `.devbox/vm/console` instead of stdout so that the first thing the
  user sees is their own shell prompt.
	- This work really well when launching a paused VM. If the VM
	  resumes fast enough, it feels like using a normal shell.
- Bootstrapping from an NixOS installer ISO with the `-install` flag is
  now fully automated. This is done by reading/writing to the VM's
  console using a pipe (similar to a program like `expect`).
- Fixed a bug where stopping the VM would always return an error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant