We can use nvidia-libs to run Windows application that uses CUDA with WIne and Bottles on NixOS.
Requirements:
-
Wine or Bottles is installed on your NixOS. I use:
packages = with.pkgs [ wineWowPackages.waylandFull bottles ] -
The Nvidia driver is installed. You can read the NixOS WIki. I believe if
$ nvidia-smirun fine we are good to go. -
Download and extract the compiled nvidia-libs from here.
-
Go inside the extracted folder as your working directory.
Wine:
- Make sure your default WINEPREFIX path at
~/.wineexists. If not, run$ wine bin/cudatest.exeto generate it. So should seeFailed to load nvcuda.dllat the end of the log. - Install the nvidia-libs by
$ WINEPREFIX=~/.wine bash ./setup_nvlibs.sh install - Set the environment variable
$ export LD_LIBRARY_PATH=/run/opengl-driver/lib:$LD_LIBRARY_PATH - Run the test again
$ wine bin/cudatest.exe. You should see your GPU card mentioned.
Bottles:
-
Create a bottles. Default setting would do fine. Says the bottle name is CudaTest and it is in
~/.local/share/bottles/bottles/CudaTest -
Replace
bottles_setup.shwith the one from the master branch since the release version we downloaded might be out-dated. -
Run the script with our bottles name as argument
$ bash ./bottles_setup.sh CudaTest. You can optionally install experimental version of nvapi. -
We may need to restart the bottles application.
-
Now go to CudaTest→Option→Settings. If we install optional nvapi we should see dxvk-nvapi-vX.X.X-XX-XXXXXXXX in Components→DXVK NVAPI. The Display→Discrete Graphics needs to be enabled.
-
Go back to CudaTest main menu. Add shortcut to
cudatest.exeby Programs→Add Shortcuts…→ pick thecudatest.exefrom bin folder. -
Launch it by Programs→cudatest→context menu (3 dot on the right)→Launch with terminal(top left icon).