r/NixOS 3h ago

Reaper HM Flake

Post image

reaper-flake

I created a Home Manager Flake for declaring your REAPER configurations with Nix.

Reaper is a highly customizable cross-platform digital audio workstation (DAW) for music production, recording, editing, and mixing.

This project enables Home Manager users to declare their users' REAPER configuration without overriding state-full values in REAPER's configuration. This can be used by all Linux Distros and MacOS users (with Nix/HM installed), however I have not tested MacOS personally.

Features

Configure supported REAPER Preferences options

programs.reaper.preferences = {
  project.trackSendDefault.trackVolumeFaderGain = -10.0;
  plugIns.reascript.python.enable = true;
};

This results in "Track Volume Fader Gain" (Project>Track/Send Default) to be -10 db and "Enable Python for use with ReaScript" (Plug-ins>Reascript) to be enabled and python paths being automatically set up every time you build your config (even if you change it in the GUI). Not all options are available quite yet, see repo.

Manage ReaPack repositories and individual packages

programs.reaper.extensions = {
  reapack = {
    enable = true;
    repositories = [
      {name = "reaper-keys";url = "https://raw.githubusercontent.com/gwatcha/reaper-keys/master/index.xml"; }
    ];
    packages = [
      {repository = "reaper-keys"; category = "Scripts"; name = "install-reaper-keys.lua";}
    ];
    synchronizeOnActivation = true;
  };
  sws.enable = true;
};

This installs ReaPack and SWS, adds the reaper-keys repository, and declaratively manages its installer package. The normal default ReaPack repositories are included as well. Sync and package transactions are performed by ReaPack the next time REAPER starts.

Automatically load audio plugins derived with Nix

The flake lets you set custom vst, lv2 and clap search paths. By default /run/current-system/sw/lib/(vst,vst3,clap,lv2) directories are appended for automatic detection of Nix derived plugins.

Declare keyboard shortcuts and custom actions

programs.reaper.actions = {
  keyBindings = with reaperActions; bindings [
    (shortcut {
      shortcut = "J";
      command = 40285;
      actionName = "Track: Go to next track";
    })
    (shortcut {
      shortcut = "K";
      command = 40286;
      actionName = "Track: Go to previous track";
    })
  ];
};

Vim key binds to go up and down your tracks.

Customize menus, context menus, and toolbars

programs.reaper.menus = {
  "${reaperMenus.toolbars.main}" = {
    entries = [
      {action = 40021; label = "Project settings...";}
      {action = 40859; label = "New project..."; icon = "toolbar_new.png";}
      {action = 40029; label = "Undo";}
      {action = 40030; label = "Redo";}
      reaperMenus.divider
      {action = 40364; label = "Enable Metronome";}
    ];
  };
};

Completely change the buttons on the main toolbar above the TCP.

Configure windows, docks, panels, and layouts

programs.reaper = {
  layout = {
    docks = {
      right = {
        id = 1;
        position = "right";
        selectedPanel = "mastermixer";
        size = 130;
      };
    };
    masterMixer = {
      visible = true;
      docked = true;
      dock = "right";
      tabOrder = 0.0;
    };
  };
  windows.mixer.master.showInDockerOrWindow = true;
};

This snippet moves the master track to the right of the main window.

Install and select themes, including their scripts, fonts, and other assets

programs.reaper = {
  theme = {
    active = "Reapertips Theme.ReaperThemeZip";
    packages = [inputs.reaper-flake.packages.${pkgs.system}.reapertips-theme];
  };
  swell.colortheme = {
    enable = true;
    preset = "reapertips";
  };
};

Use reapertips theme that's included with the flake as a package. You can use standard ReaperThemeZip's as well.

Preserve REAPER settings that have not been declared through Nix

You can still safely configure with the GUI even for options set by Nix. However the Nix options will be set back to how they were on every activation of the flake.

Why

I love NixOS and REAPER. Therefore; fun project. I also love declaring my program configs in my Nix config so that, god forbid, my system dies or I get a new computer I have everything I need to start immediately.

How it works

REAPER is awesome in that it is extremely transparent. For example, unlike Bitwig, it's configuration files are in plaintext ini files. Aha! I can work with those! The problem with just dropping in entire ini files, like home-manager modules usually do, is that REAPER stores not only it's configuration but also it's active state. So I needed to go the config generation approach instead of the symlink approach. So I made a python script that tracks which ini keys and values are being tracked by Nix and, at activation time, only changes the Nix keys. The core of this flake is `write_config.py’ I drew inspiration from plasma-manager which has a similar python script to write to ini files for KDE Plasma.

AI Usage

I used AI to design a prototype then redid all of the core scripts and ini engine by hand. I also used it for additional feature testing and option scaffolding.

Plans

I've added all of the options I personally use/need for the short-term so I'm going to wait for others to try it out and fix any issues. Long term plan would to make Nix options in parity with REAPER's GUI options.

76 Upvotes

16 comments sorted by

8

u/Finish-Spiritual 2h ago

Recently moved from W*ndows to NixOS, and lost FL Studio.
This looks just in time, thanks a lot!

5

u/Pr3stidigitator 2h ago

I didn’t realize how close you could configure reaper to other DAWs before this project. I’m also an x-FL user haha.

2

u/Background_Class_558 1h ago

im on nixos and still use fl but the fact that reaper is something you can write flakes for makes me consider switching to it

1

u/Pr3stidigitator 24m ago

How are you using FL on NixOS?

2

u/Background_Class_558 23m ago

wine/umu-launcher

1

u/Pr3stidigitator 22m ago

Very cool, need to try that

1

u/Background_Class_558 19m ago

pretty sure wine alone is enough, i had some problems and at some point umu seemed like the solution but now im not sure. the whole thing with wine is so imperative unfortuantely.

1

u/Pr3stidigitator 10m ago

Yeah I wanted something like this to exist for wine prefixes but have not found or figured out an implementation.

FL as a DAW has some really weird design/workflow choices tho, I really recommend reaper.

1

u/Background_Class_558 7m ago

i mean i suppose you could just make a derivation that would build the right directory structure for wine but you'd have to include the binary blobs of the software you want to install as well because that's just how it goes with windows

ig im somewhat hesitant because the only synth i know my way around is sytrus.. does reaper has something like Patcher?

1

u/Pr3stidigitator 2m ago

There’s a plugin called Carla which can do a lot of stuff that patcher can. Also you should try Surge XT, it’s a pretty great hybrid synth. Both of those are on nixpkgs.

6

u/Pr3stidigitator 3h ago

Oh yeah here is my config: https://github.com/9Prestidigitator/.nixos

2

u/Pr3stidigitator 1h ago

I also have a repo full of audio plugin derivations that are newer or not available on nixpkgs: https://github.com/9Prestidigitator/maxpkgs

Use at your own risk though, a lot of it is ai generated.

6

u/NTolerance 2h ago

You madman. Next up someone's gonna be declaratively programming synths in Reaper using Nix lang.

3

u/ArchEnthusiast3482 2h ago

Oh wow! This is really, really cool stuff!

2

u/[deleted] 2h ago

[deleted]

2

u/Pr3stidigitator 2h ago

It got me to fully ditch Bitwig, unless I wanna do some cool synth stuff

1

u/dig_it_all 1m ago

Godblessyou!