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?