2025-04-16 13:35:45 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}:
|
2025-04-16 11:54:14 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
# Import environment
|
|
|
|
./vm-base.nix
|
|
|
|
];
|
|
|
|
|
|
|
|
config = {
|
|
|
|
# Machine hostname
|
|
|
|
networking.hostName = "vm-audio";
|
|
|
|
|
|
|
|
# Enabled modules
|
|
|
|
modules = {
|
2025-04-16 15:15:33 +00:00
|
|
|
pipewire.enable = true;
|
2025-04-17 16:19:48 +00:00
|
|
|
spotifyd.enable = true;
|
2025-04-16 11:54:14 +00:00
|
|
|
};
|
|
|
|
|
2025-04-16 15:15:33 +00:00
|
|
|
# Install system packages
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
carla
|
2025-04-16 15:55:38 +00:00
|
|
|
wprs
|
2025-04-17 21:58:45 +00:00
|
|
|
xpra
|
2025-04-16 15:50:28 +00:00
|
|
|
xwayland
|
2025-04-17 17:44:46 +00:00
|
|
|
alsa-utils
|
|
|
|
pulsemixer
|
2025-04-18 08:02:16 +00:00
|
|
|
adwaita-icon-theme
|
2025-04-18 14:30:19 +00:00
|
|
|
waypipe
|
2025-04-18 19:49:10 +00:00
|
|
|
open-stage-control
|
2025-04-17 02:27:10 +00:00
|
|
|
|
|
|
|
# Add LV2 plugins
|
2025-04-17 01:52:48 +00:00
|
|
|
lsp-plugins
|
2025-04-17 02:27:10 +00:00
|
|
|
airwindows-lv2
|
2025-04-17 11:30:03 +00:00
|
|
|
distrho-ports
|
|
|
|
cardinal
|
2025-04-16 15:15:33 +00:00
|
|
|
];
|
|
|
|
|
2025-04-18 13:19:27 +00:00
|
|
|
# Setup firewall
|
|
|
|
networking.firewall = {
|
2025-04-18 15:34:36 +00:00
|
|
|
allowedTCPPorts = [
|
2025-04-18 19:50:14 +00:00
|
|
|
8080
|
2025-04-18 15:34:36 +00:00
|
|
|
15151
|
2025-04-18 19:50:14 +00:00
|
|
|
22752
|
2025-04-18 15:34:36 +00:00
|
|
|
];
|
|
|
|
allowedUDPPorts = [
|
2025-04-18 19:50:14 +00:00
|
|
|
8080
|
2025-04-18 15:34:36 +00:00
|
|
|
15151
|
2025-04-18 19:50:14 +00:00
|
|
|
22752
|
2025-04-18 15:34:36 +00:00
|
|
|
];
|
2025-04-18 13:19:27 +00:00
|
|
|
};
|
|
|
|
|
2025-04-17 01:04:54 +00:00
|
|
|
# Setup dependencies
|
2025-04-17 01:10:32 +00:00
|
|
|
environment.variables.LD_LIBRARY_PATH = lib.mkForce "${lib.makeLibraryPath (
|
2025-04-17 01:04:54 +00:00
|
|
|
with pkgs;
|
|
|
|
[
|
|
|
|
cairo
|
2025-04-17 01:10:32 +00:00
|
|
|
pipewire.jack
|
2025-04-17 01:04:54 +00:00
|
|
|
]
|
|
|
|
)}";
|
2025-04-18 07:58:54 +00:00
|
|
|
qt = {
|
|
|
|
enable = true;
|
|
|
|
style = "adwaita";
|
|
|
|
};
|
2025-04-18 08:02:16 +00:00
|
|
|
xdg.icons = {
|
|
|
|
enable = true;
|
|
|
|
fallbackCursorThemes = [ "Adwaita" ];
|
|
|
|
};
|
2025-04-17 01:04:54 +00:00
|
|
|
|
2025-04-16 13:23:22 +00:00
|
|
|
# User for audio mixing
|
|
|
|
users.users.mixer = {
|
2025-04-16 13:43:58 +00:00
|
|
|
isNormalUser = true;
|
2025-04-16 13:23:22 +00:00
|
|
|
group = "mixer";
|
2025-04-16 13:58:48 +00:00
|
|
|
extraGroups = [ "systemd-journal" ];
|
2025-04-16 15:04:16 +00:00
|
|
|
openssh.authorizedKeys.keys = [
|
|
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKKxoQSxfYqf9ITN8Fhckk8WbY4dwtBAXOhC9jxihJvq jan@bulthuis.dev"
|
|
|
|
];
|
2025-04-16 13:23:22 +00:00
|
|
|
};
|
2025-04-16 13:24:55 +00:00
|
|
|
users.groups.mixer = { };
|
2025-04-16 19:35:26 +00:00
|
|
|
users.groups.audio = {
|
|
|
|
members = [
|
|
|
|
"mixer"
|
|
|
|
"local"
|
|
|
|
];
|
|
|
|
};
|
2025-04-16 13:23:22 +00:00
|
|
|
|
|
|
|
# wprsd service
|
2025-04-16 13:43:58 +00:00
|
|
|
systemd.user.services.wprsd = {
|
2025-04-16 13:35:45 +00:00
|
|
|
description = "wprsd Service";
|
2025-04-16 13:23:22 +00:00
|
|
|
wantedBy = [ "default.target" ];
|
|
|
|
after = [ "network.target" ];
|
2025-04-16 13:43:58 +00:00
|
|
|
unitConfig = {
|
|
|
|
ConditionUser = "mixer";
|
|
|
|
};
|
2025-04-16 13:23:22 +00:00
|
|
|
serviceConfig = {
|
2025-04-16 16:33:26 +00:00
|
|
|
ExecStart = "${pkgs.bash}/bin/bash -l -c wprsd --enable-xwayland=true"; # Use login shell to inherit environment
|
2025-04-16 14:37:47 +00:00
|
|
|
Environment = "\"RUST_BACKTRACE=full\"";
|
2025-04-16 13:23:22 +00:00
|
|
|
Restart = "always";
|
|
|
|
RestartSec = 5;
|
|
|
|
};
|
|
|
|
};
|
2025-04-17 17:44:46 +00:00
|
|
|
|
2025-04-18 15:34:36 +00:00
|
|
|
# Xpra service
|
|
|
|
systemd.user.services.xpra = {
|
|
|
|
description = "Xpra Service";
|
|
|
|
wantedBy = [ "default.target" ];
|
|
|
|
after = [
|
|
|
|
"network.target"
|
|
|
|
];
|
|
|
|
unitConfig = {
|
|
|
|
ConditionUser = "mixer";
|
|
|
|
};
|
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "${pkgs.xpra}/bin/xpra start :7 --bind-tcp=0.0.0.0:15151 --daemon=no";
|
|
|
|
Restart = "always";
|
|
|
|
RestartSec = 5;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2025-04-18 13:12:08 +00:00
|
|
|
# Carla service
|
|
|
|
systemd.user.services.carla = {
|
|
|
|
description = "Carla Service";
|
|
|
|
wantedBy = [ "default.target" ];
|
|
|
|
after = [
|
|
|
|
"network.target"
|
|
|
|
"sound.target"
|
|
|
|
];
|
2025-04-18 15:34:36 +00:00
|
|
|
requires = [
|
|
|
|
"xpra.service"
|
|
|
|
];
|
2025-04-18 13:12:08 +00:00
|
|
|
unitConfig = {
|
|
|
|
ConditionUser = "mixer";
|
|
|
|
};
|
|
|
|
serviceConfig = {
|
2025-04-18 15:41:01 +00:00
|
|
|
ExecStart = "${pkgs.carla}/bin/carla -platform xcb /home/mixer/Default.carxp";
|
|
|
|
Environment = "\"DISPLAY=:7\"";
|
2025-04-18 13:12:08 +00:00
|
|
|
Restart = "always";
|
|
|
|
RestartSec = 5;
|
|
|
|
};
|
2025-04-18 09:57:35 +00:00
|
|
|
};
|
|
|
|
|
2025-04-18 19:49:10 +00:00
|
|
|
# Open stage control service
|
|
|
|
systemd.user.services.osc = {
|
|
|
|
description = "OSC Service";
|
|
|
|
wantedBy = [ "default.target" ];
|
|
|
|
after = [
|
|
|
|
"network.target"
|
|
|
|
];
|
|
|
|
requires = [
|
|
|
|
"carla.service"
|
|
|
|
];
|
|
|
|
unitConfig = {
|
|
|
|
ConditionUser = "mixer";
|
|
|
|
};
|
|
|
|
serviceConfig = {
|
2025-04-19 08:46:25 +00:00
|
|
|
ExecStart = "${pkgs.open-stage-control}/bin/open-stage-control --no-gui --send 127.0.0.1:22752 --load /home/mixer/open-stage-control/session.json --theme /home/mixer/open-stage-control/theme.css";
|
2025-04-18 19:49:10 +00:00
|
|
|
Environment = "\"ELECTRON_RUN_AS_NODE=1\"";
|
|
|
|
Restart = "always";
|
|
|
|
RestartSec = 5;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2025-04-18 13:12:08 +00:00
|
|
|
# Create null sinks
|
2025-04-17 17:44:46 +00:00
|
|
|
services.pipewire.extraConfig.pipewire."91-null-sinks" = {
|
|
|
|
"context.objects" = [
|
|
|
|
{
|
|
|
|
factory = "adapter";
|
|
|
|
args = {
|
|
|
|
"factory.name" = "support.null-audio-sink";
|
|
|
|
"node.name" = "SpotifyD-Proxy";
|
|
|
|
"node.description" = "Proxy for SpotifyD";
|
|
|
|
"media.class" = "Audio/Sink";
|
|
|
|
"audio.position" = "FL,FR";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
|
|
|
factory = "adapter";
|
|
|
|
args = {
|
|
|
|
"factory.name" = "support.null-audio-sink";
|
|
|
|
"node.name" = "AnalogIn-Proxy";
|
|
|
|
"node.description" = "Proxy for the analog input";
|
|
|
|
"media.class" = "Audio/Source/Virtual";
|
|
|
|
"audio.position" = "FL,FR";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2025-04-16 11:54:14 +00:00
|
|
|
};
|
|
|
|
}
|