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

aarch64-darwin support? #154

Open
LucaAttimis opened this issue Oct 18, 2023 · 6 comments
Open

aarch64-darwin support? #154

LucaAttimis opened this issue Oct 18, 2023 · 6 comments

Comments

@LucaAttimis
Copy link

We would like to use microvm to provide staging and build environments for developers, but a few of them use apple hardware/software.

I can't find a way to use this project to run aarch64-linux vm (qemu) guest on aarch64-darwin, and I guess this is not supported.

...Is there any chance of supporting this? I am not that familiar with nix, but I might contribute a patch if you have a few pointer on where to start

@astro
Copy link
Owner

astro commented Oct 18, 2023

I guess qemu should run but I don't run Darwin myself. Contributions welcome!

@sgeop
Copy link

sgeop commented Dec 16, 2023

I also would love to have this capability on nix-darwin. I typically have used nixos or fedora in the past, and my work made me switch to macos on an m2 processor, which makes virtualization/containers really painful. Lima has been a decent solution, but a project this could be a game changer for mac / nix-darwin users.

Does anyone with knowledge of this project and of macos/darwin know how feasible this would be to implent?

@ss-twieland
Copy link

ss-twieland commented Nov 21, 2024

Looking at the source code of microvm, I think it should be doable.

Not knowing anything about differences in CPU architectures and also not knowing anything about virtualisation packages (e.g. qemu) and their differences, I'm just pulling that statement out of thin air.

I started by adding "aarch64-darwin" to https://github.com/astro/microvm.nix/blob/main/flake.nix#L22.

This is a search result of x86_64 and are all the areas that should be looked at:

pkgs/alioth.nix
29:    platforms = [ "aarch64-linux" "x86_64-linux" ];

flake-template/flake.nix
16:      system = "x86_64-linux";

lib/runners/cloud-hypervisor.nix
12:    x86_64-linux = "${kernel.dev}/vmlinux";
17:    if pkgs.stdenv.system == "x86_64-linux"

lib/runners/crosvm.nix
31:    x86_64-linux = "${kernel.dev}/vmlinux";

nixos-modules/microvm/options.nix
423:        Get a full list with `qemu-system-x86_64 -M help`
491:      lib.mkIf (pkgs.system == "x86_64-linux") (

checks/default.nix
15:        guestSystem = if "${system}" == "x86_64-linux" then "aarch64-unknown-linux-gnu"
16:          else "x86_64-linux";
24:            cpu = if "${system}" == "x86_64-linux" then "cortex-a53"

lib/runners/stratovirt.nix
24:    x86_64-linux =
32:    x86_64-linux = "ttyS0";

doc/src/host.md
26:      system = "x86_64-linux";

lib/runners/qemu.nix
59:      else if system == "x86_64-linux"
83:      x86_64-linux = {
142:    else if system == "x86_64-linux"
182:    lib.optionals (system == "x86_64-linux") [
274:          # romfile= does not work with x86_64-linux and -M microvm
278:            (microvmConfig.cpu == null && system != "x86_64-linux")

checks/iperf.nix
56:            "x86_64-linux" = "kvm64,+svm,+vmx";

checks/startup-shutdown.nix
65:      else if crossSystem.config == "x86_64-linux" then
66:        "x86_64"

checks/vm.nix
14:          "x86_64-linux" = "kvm64,+svm,+vmx";

lib/runners/firecracker.nix
16:    x86_64-linux = "${kernel.dev}/vmlinux";

doc/src/packages.md
22:packages.x86_64-linux.my-microvm = self.nixosConfigurations.my-microvm.config.microvm.declaredRunner;

nixos-modules/microvm/system.nix
22:      pkgs.stdenv.targetPlatform.system == "x86_64-linux" &&

doc/src/declarative.md
27:      pkgs = import nixpkgs { system = "x86_64-linux"; };

doc/src/cpu-emulation.md
40:      system = "x86_64-linux";
45:          system = "x86_64-linux";

doc/src/declaring.md
24:      system = "x86_64-linux";

Maybe we can try creating a branch and working on it together?

@Mayeu
Copy link

Mayeu commented Nov 21, 2024

@ss-twieland I would be happy to help test things out if need be

@astro
Copy link
Owner

astro commented Nov 21, 2024

VMMs will need to run on Apple's virtualization technology, not Linux/KVM. It is not supported by most VMMs but I guess at least qemu should include support.

@ss-twieland
Copy link

There is also the MacOS runner for github:

runs-on: macos-12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants