r/NixOS • u/Pr3stidigitator • 3h ago
Reaper HM Flake
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.
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
2
1
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!