add low latency patch

This commit is contained in:
LordGrimmauld 2024-03-16 15:31:18 +01:00
parent 0b38c5ae3e
commit 92958dda3d
4 changed files with 97 additions and 1 deletions

View file

@ -45,6 +45,12 @@ in {
description = "Email for git to use"; description = "Email for git to use";
}; };
}; };
sound = mkOption {
type = types.bool;
default = false;
description = "whether to enable sound";
};
}; };
imports = [ imports = [

View file

@ -16,6 +16,45 @@
"type": "github" "type": "github"
} }
}, },
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1709336216,
"narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nix-gaming": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1710551318,
"narHash": "sha256-s1fOcZdpMbPOTuyVpzvN8QXdxS/viYjQ6J+hTR8NGys=",
"owner": "fufexan",
"repo": "nix-gaming",
"rev": "8b46b34b574cd1e6a9a8ded392f5b2f97b1f46a2",
"type": "github"
},
"original": {
"owner": "fufexan",
"repo": "nix-gaming",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1710451336, "lastModified": 1710451336,
@ -31,9 +70,28 @@
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1709237383,
"narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
"nix-gaming": "nix-gaming",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"utils": "utils" "utils": "utils"
} }

View file

@ -8,9 +8,13 @@
}; };
utils.url = "github:numtide/flake-utils"; utils.url = "github:numtide/flake-utils";
nixpkgs.url = "flake:nixpkgs/nixos-unstable"; nixpkgs.url = "flake:nixpkgs/nixos-unstable";
nix-gaming = {
url = "github:fufexan/nix-gaming";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = { self, utils, nixpkgs, ... }: let outputs = inputs @ { self, utils, nixpkgs, nix-gaming, ... }: let
lib = nixpkgs.lib; lib = nixpkgs.lib;
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};

28
modules/sound.nix Normal file
View file

@ -0,0 +1,28 @@
{ inputs, pkgs, config, lib, ... }: let
cfg = config.grimmShared;
in {
imports = [
inputs.nix-gaming.nixosModules.pipewireLowLatency
];
config = with cfg; lib.mkIf (enable && sound) {
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true; # osu uses jack
lowLatency.enable = true;
systemWide = true; # required for spotifyd as spotifyd runs as the spotifyd user
};
environment.systemPackages = with pkgs; [
pavucontrol
playerctl
pulseaudio
];
};
}