From 9459b2267b5df4296504b8b6e97cdc25d048d5ad Mon Sep 17 00:00:00 2001 From: xunuwu Date: Wed, 30 Apr 2025 00:55:11 +0200 Subject: [PATCH] use nix-gaming for audio fixes --- flake.lock | 65 +++++++++++++++++++++++++++--- flake.nix | 3 ++ sys/profiles/nix/substituters.nix | 2 + sys/profiles/services/pipewire.nix | 22 ++-------- 4 files changed, 69 insertions(+), 23 deletions(-) diff --git a/flake.lock b/flake.lock index 33d16d9..38adc13 100644 --- a/flake.lock +++ b/flake.lock @@ -295,6 +295,24 @@ } }, "flake-parts_3": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1743550720, + "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "c621e8422220273271f52058f618c94e405bb0f5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_4": { "inputs": { "nixpkgs-lib": [ "nvim-config", @@ -316,7 +334,7 @@ "type": "github" } }, - "flake-parts_4": { + "flake-parts_5": { "inputs": { "nixpkgs-lib": [ "nvim-config", @@ -338,7 +356,7 @@ "type": "indirect" } }, - "flake-parts_5": { + "flake-parts_6": { "inputs": { "nixpkgs-lib": [ "stylix", @@ -583,7 +601,7 @@ }, "hercules-ci-effects": { "inputs": { - "flake-parts": "flake-parts_4", + "flake-parts": "flake-parts_5", "nixpkgs": [ "nvim-config", "neovim-nightly-overlay", @@ -674,7 +692,7 @@ "neovim-nightly-overlay": { "inputs": { "flake-compat": "flake-compat_3", - "flake-parts": "flake-parts_3", + "flake-parts": "flake-parts_4", "git-hooks": "git-hooks", "hercules-ci-effects": "hercules-ci-effects", "neovim-src": "neovim-src", @@ -711,6 +729,27 @@ "type": "github" } }, + "nix-gaming": { + "inputs": { + "flake-parts": "flake-parts_3", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1745718727, + "narHash": "sha256-Q+8ki5/0doymTb/6yZyB1IgKy7vIkWG5IILIzw9Vz1U=", + "owner": "fufexan", + "repo": "nix-gaming", + "rev": "f42092f4379fe71bf810a71c1c33f1f807b97746", + "type": "github" + }, + "original": { + "owner": "fufexan", + "repo": "nix-gaming", + "type": "github" + } + }, "nix-github-actions": { "inputs": { "nixpkgs": [ @@ -806,6 +845,21 @@ "type": "github" } }, + "nixpkgs-lib_2": { + "locked": { + "lastModified": 1743296961, + "narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1745234285, @@ -840,7 +894,7 @@ }, "nur": { "inputs": { - "flake-parts": "flake-parts_5", + "flake-parts": "flake-parts_6", "nixpkgs": [ "stylix", "nixpkgs" @@ -942,6 +996,7 @@ "flake-parts": "flake-parts_2", "hardware": "hardware", "home-manager": "home-manager", + "nix-gaming": "nix-gaming", "nix-index-database": "nix-index-database", "nix-minecraft": "nix-minecraft", "nixpkgs": "nixpkgs_2", diff --git a/flake.nix b/flake.nix index 6c3a57b..f22a261 100644 --- a/flake.nix +++ b/flake.nix @@ -61,6 +61,9 @@ # nvfetcher.url = "github:berberman/nvfetcher"; # nvfetcher.inputs.nixpkgs.follows = "nixpkgs"; + nix-gaming.url = "github:fufexan/nix-gaming"; + nix-gaming.inputs.nixpkgs.follows = "nixpkgs"; + vpn-confinement.url = "github:Maroka-chan/VPN-Confinement"; nix-minecraft.url = "github:Infinidoge/nix-minecraft"; diff --git a/sys/profiles/nix/substituters.nix b/sys/profiles/nix/substituters.nix index bb2d804..b21c0e2 100644 --- a/sys/profiles/nix/substituters.nix +++ b/sys/profiles/nix/substituters.nix @@ -4,11 +4,13 @@ # high priority since it's almost always used "https://cache.nixos.org?priority=10" "https://nix-community.cachix.org" + "https://nix-gaming.cachix.org" ]; trusted-public-keys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" ]; }; } diff --git a/sys/profiles/services/pipewire.nix b/sys/profiles/services/pipewire.nix index 5f31243..e30ef40 100644 --- a/sys/profiles/services/pipewire.nix +++ b/sys/profiles/services/pipewire.nix @@ -1,4 +1,6 @@ -{lib, ...}: { +{inputs, ...}: { + imports = [inputs.nix-gaming.nixosModules.pipewireLowLatency]; + services.pipewire = { enable = true; alsa.enable = true; @@ -6,22 +8,6 @@ jack.enable = true; pulse.enable = true; - # https://wiki.archlinux.org/title/PipeWire#Noticeable_audio_delay_or_audible_pop/crack_when_starting_playback - wireplumber.extraConfig."51-disable-suspension.conf" = { - "monitor.alsa.rules" = lib.singleton { - matches = [ - {"node.name" = "~alsa_input.*";} - {"node.name" = "~alsa_output.*";} - ]; - actions.update-props."session.suspend-timeout.seconds" = 0; - }; - "monitor.bluez.rules" = lib.singleton { - matches = [ - {"node.name" = "~bluez_input.*";} - {"node.name" = "~bluez_output.*";} - ]; - actions.update-props."session.suspend-timeout-seconds" = 0; - }; - }; + lowLatency.enable = true; }; }