Running Wine on NixOS on Apple Silicon

I have successfully run some Windows executables using wine on NixOS installed on an Apple Silicon MacBook… but it isn’t pretty. How can I improve my setup? (Note that I am new to both wine and nixos, though I doubt I will switch back to the other linux distros anytime soon.)

As mentioned in my post on winehq.org, I got a working wine by following the setup here, then adding boot.binfmt.emulatedSystems = ["x86_64-linux"]; to my configuration.nix to provide the qemu emulation for x86_64 (since I am using Apple Silicon which is arm64 and I assume wine will not do those translations since it is not an emulator). Then I ran nix-build '<nixpkgs>' --attr wineWowPackages.waylandFull --option system x86-linux to install the Wow64 version of wine. Now, running wine notepad works! I was also able to get the 64-bit putty working, but not the 32-bit(attempting for fun as a test, I don’t actually need putty).

I also tried the most recent Adobe Reader DC zip, and that failed with the same error as the 32-bit putty. Please see the link to my winehq.org post in the previous paragraph for more details.

Also fun fact: I was able to replace the wine version provided by soda-9.0-1 with my nix-build compiled wow64 and was able to use bottles (installed by adding to configuration.nix) to run the same programs. However, running the EA installer and Pokemon Infinity were unsuccessful, having the same error as the Adobe Reader. Not sure if it was the right place, but I created a bug on github for bottles regarding the soda version.

A parting thought is, why does boot.binfmt.emulatedSystems = ["x86_64-windows"]; not provide a working wine version for arm64 on Apple Silicon? Does the wine.nix build config need updated for wow64?

I also use Wine WoW64 to run 64-bit packages on NixOS on apple silicon, and I use it with Box64 when I need emulation to X86_64. But I want to point out how that is both for 64 bit applications. Unlike Raspberry Pis, the Jetson Nano, and several other of the common Linux ARM SBCs, Apple Silicon only supports 64-bit ARM – it simply cannot run 32 bit code.

Wine WoW64 is not an emulator, its just a translation layer, and both Box64 and emulating an x86_64 system will not translate x86 binaries (32-bit) to x86_64. Box64 does, now, support running 32-bit packages, and although it works great most of the time, I’ve definitely discovered some issues with that compatability. I would recommend FEX – its worked pretty well for me in emulating both x86 and x64 programs on apple silicon.

I originally found this solution on this reddit thread about a year ago – although I have noticed a couple resolved github issues for wine mentioning improving support in asahi linux (and therefore NixOS on apple silicon) since then, so it might be worth giving it another try. There are only a couple programs I need to emulate, and I haven’t had to mess with them recently, so I apologize for most of my information being from earlier this year.

Hopefully you get this sorted out, and remember, Wine Is Not an Emulator :slight_smile: