Skip to content

Commit

Permalink
rosetta for x86
Browse files Browse the repository at this point in the history
  • Loading branch information
zupo authored Feb 14, 2025
1 parent 288f889 commit 322282b
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion source/guides/recipes/macos
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,25 @@ Luckily, there is a workaround, called "nested virtualization" which allows the
Follow the same process as above, but when creating the UTM image, tick the `Use Apple Virtualization` checkbox. You will have to recreate the image, but the steps are the same.


TODO: how to rerun example test
## x86 Virtualization

But what if you have to run NixOS tests for a specific CPU architecture? For example, let's say you need to test that your Nix code runs well on an Intel CPU. You run the following command:

```
$ nix -L build --system x86_64-linux github:tfc/nixos-integration-test-example --rebuild
error: some outputs of '/nix/store/...-vm-test-run-An-awesome-test..drv' are not valid, so checking is not possible
```

The UTM VM you created above is based on the ARM architecture and as such can't run VMs for Intel. However, we are in luck again, Apple has provided us with another trick, called Rosetta, which enables us to run x86-based VMs!

Shut down the VM and enter its settings. Under `Virtualization`, tick the `Enable Rosetta on Linux` checkbox.

Boot the VM back up, add `virtualisation.rosetta.enable = true;` to your `configuration.nix` and run `nixos-rebuild switch`. Now, you can run NixOS tests for x86_64 too!

```
$ nix -L build --system x86_64-linux github:tfc/nixos-integration-test-example
```




0 comments on commit 322282b

Please sign in to comment.