Skip to content

Latest commit

 

History

History
125 lines (90 loc) · 4.91 KB

File metadata and controls

125 lines (90 loc) · 4.91 KB

JACK to ASIO with pipewire on NixOS

Thanks to TimP4w for writing this.

This guide is unmaintained, because it's significantly different than the other ones and Nizo doesn't understand NixOs-specific stuff. If you want to help, go ahaed and create pull-requests, or issues with instructions on what to change.

Table of contents

  1. NixOS Configuration 🡰 You are here
  2. Choose your method
  3. Method 1 - Manual
    1. Create a clean prefix
    2. wineasio
    3. Installing RS_ASIO
    4. Reboot
  4. Method 2 - script
  5. Set up JACK
  6. Starting the game
  7. Known Issues
  8. Troubleshooting

Tested and working with

NixOS 24.05.20240524.d12251e (Uakari) [64-bit]
Wineasio: wineasio-1.2.0
Pipewire Jack: pipewire-1.0.6-jack
RS_ASIO: 0.7.1
Proton: Proton - Experimental, Proton 9.0 (Beta) and Proton 8.0

NixOS Configuration

Assumptions

  • You have steam (programs.steam.enable = true;) installed
    • This is very important, because we need steam that comes with its own FHS environment AND steam-run to be able to execute commands in this environment.
  • You use the pipewire service from nixpkgs (services.pipewire.enable = true;)

After applying the configuration, reboot your PC.

Minimal Configuration

  ### Audio
  sound.enable = true;

  services.pipewire = {
    enable = true;
    jack.enable = true;
  };


  ### Audio Extra
  security.rtkit.enable = true; # Enables rtkit (https://directory.fsf.org/wiki/RealtimeKit)

  #
  # domain = "@audio": This specifies that the limits apply to users in the @audio group.
  # item = "memlock": Controls the amount of memory that can be locked into RAM.
  # value (`unlimited`) allows members of the @audio group to lock as much memory as needed. This is crucial for audio processing to avoid swapping and ensure low latency.
  #
  # item = "rtprio": Controls the real-time priority that can be assigned to processes.
  # value (`99`) is the highest real-time priority level. This setting allows audio applications to run with real-time scheduling, reducing latency and ensuring smoother performance.
  #
  security.pam.loginLimits = [
    { domain = "@audio"; item = "memlock"; type = "-"; value = "unlimited"; }
    { domain = "@audio"; item = "rtprio"; type = "-"; value = "99"; }
  ];

  # Add user to `audio` and `rtkit` groups.
  users.users.<username>.extraGroups = [ "audio" "rtkit" ];

  environment.systemPackages = with pkgs; [
    qjackctl
    rtaudio
  ];

  ### Steam (https://nixos.wiki/wiki/Steam)
  programs.steam = {
    enable = true;
    package = pkgs.steam.override {
      extraLibraries = pkgs: [ pkgs.pkgsi686Linux.pipewire.jack ]; # Adds pipewire jack (32-bit)
      extraPkgs = pkgs: [ pkgs.wineasio ]; # Adds wineasio
    };
  };

Explanation

We of course want mainly two things: audio and Steam. These are pretty much self-explanatory, but there are some more settings that we need:

Audio

We use pipewire (services.pipewire) and pipewire-jack. The goal is to connect jack to wine via wineasio.

I noticed that for audio we need some extra things:

  • rtkit: without this the game just crashes
  • PAM loginLimits: we also need to set some limits here for the audio group to access real-time scheduling with a higher priority.
  • user groups: we add our user to the audio and rtkit groups to enable these limits for us
  • qjackctl to control our audio pipeline (there are also other alternatives here, such as helvum or qpwgraph)

Steam

Here we only want to add two things:

  • wineasio, to connect JACK with wine
  • The 32-bit libraries of pipewire JACK since Rocksmith is a 32-bit game.

NixOS is not using the FHS convention however the official steam program is packaged with its own FHS environment. So what we are doing is to add an extra library (pkgsi686Linux.pipewire.jack) to the default environment that comes from nixpkgs. For wineasio we only need some .dll and .so files that we usually need to compile. However if we install it via nixpkgs, this is done automatically and we can later copy the generated files (see below).

Choose your method

You must apply the configuration and rebuild your system BEFORE continuing.

Method 1 - Manual

Everything is done by hand.

Continue here

Method 2 - Automated Script

A script that does almost everything automatically is provided in this repo.

Continue here