From e92487487e9f197ccb7771c87d3be3c320ce1a3f Mon Sep 17 00:00:00 2001 From: Annika Merris Date: Fri, 24 May 2024 12:44:04 -0400 Subject: [PATCH] Moved Audio Config to New File Added service to set up passthrough from my work laptop --- hosts/envy/hardware-configuration.nix | 39 +++++++++++++++++++++++++++ hosts/kim/audio.nix | 29 ++++++++++++++++++++ hosts/kim/default.nix | 18 +------------ hosts/kim/pw-link.sh | 4 +++ 4 files changed, 73 insertions(+), 17 deletions(-) create mode 100644 hosts/envy/hardware-configuration.nix create mode 100644 hosts/kim/audio.nix create mode 100644 hosts/kim/pw-link.sh diff --git a/hosts/envy/hardware-configuration.nix b/hosts/envy/hardware-configuration.nix new file mode 100644 index 0000000..9b4ae19 --- /dev/null +++ b/hosts/envy/hardware-configuration.nix @@ -0,0 +1,39 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/a9a6d64b-bcf3-44e6-8c1a-fdb8d68d124c"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/ABD8-19B1"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp3s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/kim/audio.nix b/hosts/kim/audio.nix new file mode 100644 index 0000000..2db6a73 --- /dev/null +++ b/hosts/kim/audio.nix @@ -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" + ''; + }; +} diff --git a/hosts/kim/default.nix b/hosts/kim/default.nix index 3669187..bb2ff2a 100644 --- a/hosts/kim/default.nix +++ b/hosts/kim/default.nix @@ -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 diff --git a/hosts/kim/pw-link.sh b/hosts/kim/pw-link.sh new file mode 100644 index 0000000..b2171e6 --- /dev/null +++ b/hosts/kim/pw-link.sh @@ -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"