-
Notifications
You must be signed in to change notification settings - Fork 39
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
macOS support? #16
Comments
This would need some major refactorings in nixpkgs itself. Qemu would need to be built for macOS itself, while the image itself needs to target Linux. Basically the NixOS module that provides our qemu abstraction needs to evaluate on macOS and than nixpkgs is imported again with Linux as the target for the rest. |
Interestingly enough there is a macOS target for the qemu binary: https://github.com/NixOS/nixpkgs/blob/master/nixos/lib/qemu-flags.nix#L28 |
I don't think it needs refactoring for that reason. I almost got it running with this config: { pkgs, ... }: {
nixos-shell.mounts.mountHome = false;
system.build.qemu = (import <nixpkgs> {}).pkgs.qemu_test;
} However, it seems like virtfs isn't supported on macos, so it still failed: $ nixos-shell -- --arg system '"x86_64-linux"'
/nix/store/4292rkypmhb9fzmc4yj4dnjy27j5iy3h-nixos-vm
qemu-system-x86_64: -virtfs local,path=/nix/store,security_model=none,mount_tag=store: There is no option group 'virtfs'
qemu-system-x86_64: -virtfs local,path=/nix/store,security_model=none,mount_tag=store: virtfs support is disabled I don't know if there are other options for mounting the nix store, but this is how far I've gotten now. |
qemu has builtin support for smb, which might work. Otherwise NFS could be used. The latter lone might require a bit more setup code. |
I've managed to get nixos-shell working on macOS by tying together PRs waiting to be merged to nixpkgs as well as some of my own changes: |
Might be also interesting for you: @kloenk |
@r2r-dev what about aarch64? I have a m1 Mac, so would be interested in that. |
Haven't tried that yet. afaik x86_64-darwin qemu should work just fine via rosetta, however, it might not be the best way to go. To make it somehow more usable:
With the above changes in place, it should be possible to run virtualized aarch64-linux guests, as well as emulated x86_64 guests. Finally, there's some additional patching required to make a network adapter somewhat more performant [2]. Also, it looks like @benpye has some experience in this field [3]. I'll test nixos-shell on m1 Mac with this overlay applied on top of my nixpkgs fork. Stay tuned. [0]: https://patchwork.kernel.org/project/qemu-devel/patch/[email protected]/ |
what is needed?
The text was updated successfully, but these errors were encountered: