Native Access on Linux with nix and wine

Posted on Saturday, Nov 4, 2023
A photo of my NixOS recording setup with Kontakt running in REAPER

A few years back, I bought one of Native Instruments "Komplete" bundles during a holiday sale, and I had a lot of fun playing around with Kontat and a couple of their synth plugins. At the time I was mostly making music on my MacBook, but I eventually decided I wanted a dedicated desktop machine for recording and production.

I like building PCs and tinkering with stuff. So instead of grabbing a Mac Mini, I bought an Intel NUC and put it in a fanless, passively cooled enclosure so I could run it completely silently. It cost about $800 USD all in, which is as much as a "mid tier" Mac Mini, but with four times the RAM and twice the storage. And there's still room in the enclosure for a SATA SSD, so I can pack a few more terabytes in there if I need to, which is nice.

While I did have a go at installing NixOS on it, I was pretty new to nix at the time and it didn't quite work out. I eventually caved and installed Windows on the thing so I could actually make some music with it instead of tinker with setting things up.

Fast forward a bit, and Windows finally wore me down with its constant updates breaking things. I decided to revisit running NixOS on this thing, and after backing up the important stuff, I wiped my disk and set up a clean NixOS install. As soon as the system was set up, I started trying to get the Native Instruments stuff working via wine. This turned out to be enough of a hassle that I figure it's worth blogging about to hopefully save the next poor soul a few hours.

If you want to skip all the chatter and try it for yourself, head to my native-access-nix repo and give it a try!

The plan

I had read that most Native Instruments plugins work well with yabridge, a marvelous hack that runs Windows VST plugins using wine and shuffles audio data to a linux VST host that DAWs can use. The problem is that you need to install things using NI's installer app "Native Access", so that it can write a license receipt or whatever it does to mark your stuff as legit. The latest version of Native Access is based on electron and doesn't run via wine, but luckily they make the last release of Native Access v1 available to download to support older versions of Windows.

I had previously found a really nice way to wrap wine apps with nix that I used to get an ancient version of Amazon's Kindle app running. It works by creating a wine "prefix" (an isolated wine installation, basically) for each wrapped app and using a "first run script" to run the installer EXE file when you first try to run the app.

So, the plan was to use the wrapWine helper to install Native Access v1 and use yabridge to run the plugins, using the excellent REAPER as the DAW.

The struggle

There followed a few days of flailing around trying to figure out how to install the app and get it to run without crashing.

The key to getting the Native Access installer to work correctly is to tell wine to pretend to be Windows 10 instead of its default. In the wrapWine first run script, I use winecfg /v win10 before running the installer to set the version. With lower Windows versions, the installer will try to install a driver for mounting ISO images, which wine doesn't like, and the install gets stuck and hangs forever.

Once installed, the app would crash immediately with a bunch of cryptic errors. I spent a while trying out various "winetricks", which generally work by downloading DLLs from Microsoft and using them instead of wine's built-in implementations. After much experimentation, I discovered the magic trick, ucrtbase2019. With that in place, the app starts and asks you to log in with your Native Instruments account.

Success!

Installing Kontakt worked right away, but a bunch of other plugins failed to install with an error message saying that Native Access was unable to mount an ISO image. This is a known issue with Native Access running in wine, and the yabridge README has helpful instructions for how to work around it by mounting the downloaded ISO in linux and running the installer with wine.

I did that manually a few times before I got bored and decided to write a script to automate the process. The ni-plugin-install script will scan the Downloads folder inside the wine prefix and ask which ISO file you want to install, then mount it and run the installer using the same wine prefix, so everything ends up where it's supposed to. Once you install the plugin manually, you can open Native Access again and it will discover the installation and do whatever license registration thing it needs to do to make it usable.

Wrapping up

I initially hacked all this together in my main nix-config repo, but as this seems like something other nix nerds might find useful, I decided to split it out into its own nix flake.

If you're running NixOS and want to install Native Instruments stuff, check out native-access-nix and let me know how it goes! It should also work on other Linux distributions, so long as you have a flake-enabled nix installed, but I haven't tried that yet, so no promises.

While it was a bit of a pain to get everything working, the beauty of nix is that it's likely to stay working, and I can set the whole thing up on a new machine in the future without needing to decipher my cryptic notes or go hunting through old forum posts. And it feels pretty good to know that I'll never see an ad for Candy Crush in my taskbar because some product manager at Microsoft is gunning for a promotion.