nixos-config/configurations/host/materusPC/audio.nix

91 lines
2.1 KiB
Nix
Raw Normal View History

2024-03-05 13:25:01 +01:00
{ pkgs, lib, ... }:
{
2025-05-23 18:07:26 +02:00
#REGION test
2025-04-18 11:50:53 +02:00
#sound.enable = true;
2024-03-05 13:25:01 +01:00
security.rtkit.enable = true;
services.pipewire = {
enable = true;
audio.enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
2025-05-23 18:07:26 +02:00
systemWide = true;
2024-03-05 13:25:01 +01:00
jack.enable = true;
};
hardware.pulseaudio.enable = false;
2024-03-11 16:19:31 +01:00
environment.sessionVariables =
let
2025-05-23 18:07:26 +02:00
makePluginPath =
format:
"$HOME/.${format}:"
+ (lib.makeSearchPath format [
2024-03-05 13:25:01 +01:00
"$HOME/.nix-profile/lib"
"/run/current-system/sw/lib"
"/etc/profiles/per-user/$USER/lib"
2025-05-23 18:07:26 +02:00
]);
2024-03-11 16:19:31 +01:00
in
{
ALSOFT_DRIVERS = "pulse";
2024-03-05 13:25:01 +01:00
2024-03-11 16:19:31 +01:00
DSSI_PATH = makePluginPath "dssi";
LADSPA_PATH = makePluginPath "ladspa";
LV2_PATH = makePluginPath "lv2";
LXVST_PATH = makePluginPath "lxvst";
VST_PATH = makePluginPath "vst";
VST3_PATH = makePluginPath "vst3";
2024-03-05 13:25:01 +01:00
2024-03-11 16:19:31 +01:00
};
2024-03-05 13:25:01 +01:00
2025-05-23 18:07:26 +02:00
services.udev = let
script = pkgs.writeShellScript "arch-mknod" ''
ACTION=$1
KERNEL=$(basename $2)
MAJOR=$3
MINOR=$4
if (systemctl is-active --quiet systemd-nspawn@archlinux); then
if [[ $ACTION == "add" || "$ACTION" == "change" ]]; then
machinectl shell root@archlinux /bin/bash -c "
if ! [ -f /dev/$KERNEL ]; then
mknod /dev/$KERNEL c $MAJOR $MINOR
chmod 660 /dev/$KERNEL
chown root:input /dev/$KERNEL
fi
"
elif [[ $ACTION == "remove" ]]; then
machinectl shell root@archlinux /bin/rm /dev/$KERNEL
fi
fi
'';
in {
2024-03-05 13:25:01 +01:00
extraRules = ''
2024-03-11 16:19:31 +01:00
KERNEL=="rtc0", GROUP="audio"
KERNEL=="hpet", GROUP="audio"
DEVPATH=="/devices/virtual/misc/cpu_dma_latency", OWNER="root", GROUP="audio", MODE="0660"
2025-05-23 18:07:26 +02:00
SUBSYSTEM=="hidraw", KERNEL=="hidraw*", RUN+="${script} ''$env{ACTION} ''$env{DEVNAME} ''$env{MAJOR} ''$env{MINOR}"
2024-03-05 13:25:01 +01:00
'';
};
2024-03-11 16:19:31 +01:00
environment.systemPackages = with pkgs; [
2024-03-05 13:25:01 +01:00
openal
pulseaudio
reaper
yabridge
yabridgectl
vital
odin2
surge
fire
2024-03-05 13:36:20 +01:00
decent-sampler
lsp-plugins
2024-03-05 13:25:01 +01:00
];
2024-03-11 16:19:31 +01:00
}