nixos-config/machines/vm-audio.nix

111 lines
2.4 KiB
Nix
Raw Normal View History

2025-04-16 15:35:45 +02:00
{
lib,
pkgs,
config,
...
}:
{
imports = [
# Import environment
./vm-base.nix
];
config = {
# Machine hostname
networking.hostName = "vm-audio";
# Enabled modules
modules = {
2025-04-16 17:15:33 +02:00
pipewire.enable = true;
};
2025-04-16 17:15:33 +02:00
# Install system packages
environment.systemPackages = with pkgs; [
carla
2025-04-16 17:55:38 +02:00
wprs
2025-04-16 17:50:28 +02:00
xwayland
2025-04-17 04:27:10 +02:00
# Add LV2 plugins
2025-04-17 03:52:48 +02:00
lsp-plugins
2025-04-17 04:27:10 +02:00
airwindows-lv2
2025-04-17 13:30:03 +02:00
distrho-ports
cardinal
2025-04-16 17:15:33 +02:00
];
2025-04-17 03:04:54 +02:00
# Setup dependencies
2025-04-17 03:10:32 +02:00
environment.variables.LD_LIBRARY_PATH = lib.mkForce "${lib.makeLibraryPath (
2025-04-17 03:04:54 +02:00
with pkgs;
[
cairo
2025-04-17 03:10:32 +02:00
pipewire.jack
2025-04-17 03:04:54 +02:00
]
)}";
2025-04-17 15:20:50 +02:00
# # Pipewire roc source
2025-04-17 15:03:01 +02:00
# services.pipewire.extraConfig.pipewire."60-roc-source" = {
# "context.modules" = [
# {
# "name" = "libpipewire-module-roc-source";
# "args" = {
# "fec.code" = "rs8m";
# "local.ip" = "0.0.0.0";
# "resampler.profile" = "medium";
# # sess.latency.msec = 10;
# "local.source.port" = 10001;
# "local.repair.port" = 10002;
# "source.name" = "Roc Source";
# "source.props.node.name" = "roc-source";
# };
# }
# ];
# };
2025-04-17 14:42:54 +02:00
2025-04-17 15:20:50 +02:00
# # Set firewall ports
# networking.firewall = {
# enable = true;
# allowedTCPPorts = [
# 10001
# 10002
# ];
# allowedUDPPorts = [
# 10001
# 10002
# ];
# };
2025-04-17 14:42:54 +02:00
2025-04-16 15:23:22 +02:00
# User for audio mixing
users.users.mixer = {
2025-04-16 15:43:58 +02:00
isNormalUser = true;
2025-04-16 15:23:22 +02:00
group = "mixer";
2025-04-16 15:58:48 +02:00
extraGroups = [ "systemd-journal" ];
2025-04-16 17:04:16 +02:00
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKKxoQSxfYqf9ITN8Fhckk8WbY4dwtBAXOhC9jxihJvq jan@bulthuis.dev"
];
2025-04-16 15:23:22 +02:00
};
2025-04-16 15:24:55 +02:00
users.groups.mixer = { };
2025-04-16 21:35:26 +02:00
users.groups.audio = {
members = [
"mixer"
"local"
];
};
2025-04-16 15:23:22 +02:00
# wprsd service
2025-04-16 15:43:58 +02:00
systemd.user.services.wprsd = {
2025-04-16 15:35:45 +02:00
description = "wprsd Service";
2025-04-16 15:23:22 +02:00
wantedBy = [ "default.target" ];
after = [ "network.target" ];
2025-04-16 15:43:58 +02:00
unitConfig = {
ConditionUser = "mixer";
};
2025-04-16 15:23:22 +02:00
serviceConfig = {
2025-04-16 18:33:26 +02:00
ExecStart = "${pkgs.bash}/bin/bash -l -c wprsd --enable-xwayland=true"; # Use login shell to inherit environment
2025-04-16 16:37:47 +02:00
Environment = "\"RUST_BACKTRACE=full\"";
2025-04-16 15:23:22 +02:00
Restart = "always";
RestartSec = 5;
};
};
};
}