From f4772d075a92bdddd2f3f2d8e1148d891771f210 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 3 Aug 2024 22:15:32 +0200 Subject: [PATCH 1/4] output: allow to have host defined in subdirectory --- outputs.nix | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/outputs.nix b/outputs.nix index aced032..f69f3bf 100644 --- a/outputs.nix +++ b/outputs.nix @@ -22,22 +22,22 @@ self = { filePaths = lib.pipe ./hosts [ builtins.readDir ( lib.filterAttrs (name: type: - # filter out non-nix files - type == "regular" - # filter out files that don't end in .nix - && lib.hasSuffix ".nix" name + ( # regular .nix files + (type == "regular" && lib.hasSuffix ".nix" name) + || # directories that contain a default.nix file + (type == "directory" && builtins.pathExists "${./hosts}/${name}/default.nix") + ) # filter out files that start with . && !lib.hasPrefix "." name )) - (lib.mapAttrsToList (name: _: name)) ]; nixosSystem = import "${inputs.nixpkgs}/nixos/lib/eval-config.nix"; in # mapped list of nix file paths to attrSet with initialized NixOS configurations, # whose names are derived from file names lib.pipe filePaths [ - (builtins.map (name: { - name = builtins.substring 0 (builtins.stringLength name - 4) name; + (builtins.mapAttrs (name: type: { + name = if type == "directory" then name else builtins.substring 0 (builtins.stringLength name - 4) name; value = nixosSystem { inherit lib; modules = [ @@ -53,6 +53,7 @@ self = { specialArgs = { inherit self inputs; }; }; })) + builtins.attrValues builtins.listToAttrs ]; }; From 79527c7663301d9d7e91ca14d14fb11d11639233 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 3 Aug 2024 22:17:25 +0200 Subject: [PATCH 2/4] hosts/main: move to subdirectory --- hosts/{main.nix => main/default.nix} | 35 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 18 deletions(-) rename hosts/{main.nix => main/default.nix} (55%) diff --git a/hosts/main.nix b/hosts/main/default.nix similarity index 55% rename from hosts/main.nix rename to hosts/main/default.nix index cfa6e41..8faf041 100644 --- a/hosts/main.nix +++ b/hosts/main/default.nix @@ -2,24 +2,23 @@ { imports = [ - ../nix-os/core.nix - ../nix-os/core-desktop.nix - ../nix-os/nvidia.nix - ../nix-os/docker.nix - ../nix-os/razer.nix - ../nix-os/desktopManagers/gnome.nix - ../nix-os/displayManagers/gdm.nix - #../nix-os/desktop/kde-plasma.nix - ../nix-os/shell.nix - ../nix-os/virtualization.nix - ../nix-os/polkit/disable-shutdown.nix - ../nix-os/locale.nix - ../nix-os/adb.nix - ../nix-os/account.nix - ../nix-os/xdg-default-apps.nix - ../nix-os/services/nix-binary-cache.nix - ../nix-os/udev.nix - ../nix-os/gnupg.nix + ../../nix-os/core.nix + ../../nix-os/core-desktop.nix + ../../nix-os/nvidia.nix + ../../nix-os/docker.nix + ../../nix-os/razer.nix + ../../nix-os/desktopManagers/gnome.nix + ../../nix-os/displayManagers/gdm.nix + ../../nix-os/shell.nix + ../../nix-os/virtualization.nix + ../../nix-os/polkit/disable-shutdown.nix + ../../nix-os/locale.nix + ../../nix-os/adb.nix + ../../nix-os/account.nix + ../../nix-os/xdg-default-apps.nix + ../../nix-os/services/nix-binary-cache.nix + ../../nix-os/udev.nix + ../../nix-os/gnupg.nix "${inputs.nixos-vscode-server}" ]; From 7ce2abb122aec3a13ab31e1d31efeb9072654bad Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 3 Aug 2024 23:29:29 +0200 Subject: [PATCH 3/4] hosts/main: move wireplumber configuration to git --- hosts/main/default.nix | 12 ++++++++++ hosts/main/wireplumber/51-digital-output.conf | 10 +++++++++ hosts/main/wireplumber/51-hdmi-otuput.conf | 10 +++++++++ .../51-razerHeadphones-device.conf | 11 ++++++++++ .../wireplumber/51-razerHeadphones-input.conf | 10 +++++++++ .../51-razerHeadphones-output.conf | 22 +++++++++++++++++++ 6 files changed, 75 insertions(+) create mode 100644 hosts/main/wireplumber/51-digital-output.conf create mode 100644 hosts/main/wireplumber/51-hdmi-otuput.conf create mode 100644 hosts/main/wireplumber/51-razerHeadphones-device.conf create mode 100644 hosts/main/wireplumber/51-razerHeadphones-input.conf create mode 100644 hosts/main/wireplumber/51-razerHeadphones-output.conf diff --git a/hosts/main/default.nix b/hosts/main/default.nix index 8faf041..d35b5bc 100644 --- a/hosts/main/default.nix +++ b/hosts/main/default.nix @@ -45,6 +45,18 @@ ]; }; + services.pipewire.wireplumber.configPackages = [( + pkgs.stdenvNoCC.mkDerivation { + name = "wireplumber-config"; + src = ./wireplumber; + phases = [ "installPhase" ]; + installPhase = '' + mkdir -p $out/share/wireplumber/wireplumber.conf.d + cp -r $src/* $out/share/wireplumber/wireplumber.conf.d + ''; + } + )]; + services.printing.startWhenNeeded = false; system.stateVersion = "23.05"; diff --git a/hosts/main/wireplumber/51-digital-output.conf b/hosts/main/wireplumber/51-digital-output.conf new file mode 100644 index 0000000..57bdff3 --- /dev/null +++ b/hosts/main/wireplumber/51-digital-output.conf @@ -0,0 +1,10 @@ +monitor.alsa.rules = [{ + matches = [{ + node.name = "alsa_output.pci-0000_00_1f.3.iec958-stereo" + }] + actions = { + update-props = { + node.description = "Digital Output" + } + } +}] diff --git a/hosts/main/wireplumber/51-hdmi-otuput.conf b/hosts/main/wireplumber/51-hdmi-otuput.conf new file mode 100644 index 0000000..265b78a --- /dev/null +++ b/hosts/main/wireplumber/51-hdmi-otuput.conf @@ -0,0 +1,10 @@ +monitor.alsa.rules = [{ + matches = [{ + node.name = "alsa_output.pci-0000_01_00.1.hdmi-stereo" + }] + actions = { + update-props = { + node.description = "Monitor speakers" + } + } +}] diff --git a/hosts/main/wireplumber/51-razerHeadphones-device.conf b/hosts/main/wireplumber/51-razerHeadphones-device.conf new file mode 100644 index 0000000..b159a49 --- /dev/null +++ b/hosts/main/wireplumber/51-razerHeadphones-device.conf @@ -0,0 +1,11 @@ +monitor.alsa.rules = [{ + matches = [{ + device.name = "alsa_card.usb-Razer_Razer_USB_Audio_Controller_000000000000000000000000-00" + }] + actions = { + update-props = { + device.description = "Headphones" + device.profile = "Pro Audio" + } + } +}] diff --git a/hosts/main/wireplumber/51-razerHeadphones-input.conf b/hosts/main/wireplumber/51-razerHeadphones-input.conf new file mode 100644 index 0000000..c24a599 --- /dev/null +++ b/hosts/main/wireplumber/51-razerHeadphones-input.conf @@ -0,0 +1,10 @@ +monitor.alsa.rules = [{ + matches = [{ + node.name = "alsa_input.usb-Razer_Razer_USB_Audio_Controller_000000000000000000000000-00.pro-input-0" + }] + actions = { + update-props = { + node.description = "Headphones" + } + } +}] diff --git a/hosts/main/wireplumber/51-razerHeadphones-output.conf b/hosts/main/wireplumber/51-razerHeadphones-output.conf new file mode 100644 index 0000000..11cb43e --- /dev/null +++ b/hosts/main/wireplumber/51-razerHeadphones-output.conf @@ -0,0 +1,22 @@ +monitor.alsa.rules = [ + { + matches = [{ + node.name = "alsa_output.usb-Razer_Razer_USB_Audio_Controller_000000000000000000000000-00.pro-output-0" + }] + actions = { + update-props = { + node.description = "Headphones (Chat)" + } + } + } + { + matches = [{ + node.name = "alsa_output.usb-Razer_Razer_USB_Audio_Controller_000000000000000000000000-00.pro-output-1" + }] + actions = { + update-props = { + node.description = "Headphones (Game)" + } + } + } +] From c52624db8f026314f4479f50590a5153d5c616c7 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 3 Aug 2024 23:31:34 +0200 Subject: [PATCH 4/4] lock: update nixpkgs --- lock.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lock.nix b/lock.nix index 930ea4e..2963614 100644 --- a/lock.nix +++ b/lock.nix @@ -4,7 +4,7 @@ sha256 = "1rq8mrlmbzpcbv9ys0x88alw30ks70jlmvnfr2j8v830yy5wvw7h"; }; nixpkgs = { - revision = "0c53b6b8c2a3e46c68e04417e247bba660689c9d"; - sha256 = "02ag4j9v48h861bakxf7nvcz85wl6dv8wvfj0v1r7v7j8jpwp8vg"; + revision = "05405724efa137a0b899cce5ab4dde463b4fd30b"; + sha256 = "06490pn22x9xl4chfx12iwdgx7nlbn14v8x05rnv2y1nancljisl"; }; }