Moved Audio Config to New File

Added service to set up passthrough from my work laptop
This commit is contained in:
Annika Merris 2024-05-24 12:44:04 -04:00
parent 93764b9520
commit e92487487e
4 changed files with 73 additions and 17 deletions

29
hosts/kim/audio.nix Normal file
View file

@ -0,0 +1,29 @@
{ config, lib, pkgs, ... }:
{
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
systemd.user.services.pipewire-patching = {
description = "pipewire patches";
wantedBy = [ "default.target" ];
script = ''
pw-link "alsa_output.pci-0000_0e_00.4.iec958-stereo:playback_FL" "alsa_input.pci-0000_0e_00.4.analog-stereo:capture_FL"
pw-link "alsa_output.pci-0000_0e_00.4.iec958-stereo:playback_FR" "alsa_input.pci-0000_0e_00.4.analog-stereo:capture_FR"
'';
};
}

View file

@ -14,6 +14,7 @@ inputs.nixpkgs.lib.nixosSystem {
sops-nix.nixosModules.sops
./hardware-configuration.nix
./gui.nix
./audio.nix
../../modules/common
../../modules/nixos
{
@ -59,23 +60,6 @@ inputs.nixpkgs.lib.nixosSystem {
services.flatpak.enable = true;
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# gui.enable = true;
# Apps

4
hosts/kim/pw-link.sh Normal file
View file

@ -0,0 +1,4 @@
#!/user/bin/env bash
pw-link "alsa_output.pci-0000_0e_00.4.iec958-stereo:playback_FL" "alsa_input.pci-0000_0e_00.4.analog-stereo:capture_FL"
pw-link "alsa_output.pci-0000_0e_00.4.iec958-stereo:playback_FR" "alsa_input.pci-0000_0e_00.4.analog-stereo:capture_FR"