Add nix-gaming input for pulse low latency, fixup gamescope and gamemode

This commit is contained in:
Chris Toph 2025-03-31 12:19:32 -04:00
parent 6bfb44bf85
commit 1963db6714
5 changed files with 50 additions and 10 deletions

View file

@ -67,6 +67,13 @@
## Misc Packages ##
nix-gaming = {
url = "github:fufexan/nix-gaming";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
# nixcord.url = "github:kaylorben/nixcord";
# spicetify-nix = {
# url = "github:Gerg-L/spicetify-nix";

View file

@ -8,32 +8,41 @@
}:
let
# monitor = lib.head (lib.filter (m: m.primary) config.monitors);
monitor = lib.head (lib.filter (m: m.primary) config.monitors);
steam-session =
let
gamescope = lib.concatStringsSep " " [
(lib.getExe pkgs.gamescope)
# "--output-width ${toString monitor.width}"
# "--output-height ${toString monitor.height}"
# "--framerate-limit ${toString monitor.refreshRate}"
# "--prefer-output ${monitor.name}"
"--rt"
"--output-width ${toString monitor.width}"
"--output-height ${toString monitor.height}"
"--framerate-limit ${toString monitor.refreshRate}"
"--prefer-output ${monitor.name}"
"--adaptive-sync"
"--expose-wayland"
"--backend wayland"
"--steam"
# "--hdr-enabled"
];
steam = lib.concatStringsSep " " [
"steam"
#"steam://open/bigpicture"
"-forcedesktopscaling ${toString monitor.scale}"
"-nofriendsui"
"-noschatui"
];
in
pkgs.writeTextDir "share/applications/steam-session.desktop" ''
[Desktop Entry]
Name=Steam Session
Comment=Steam with Gamescope
Exec=${gamescope} -- ${steam}
Icon=steam
Type=Application
Categories=Network;FileTransfer;Game;
MimeType=x-scheme-handler/steam;x-scheme-handler/steamlink;
PrefersNonDefaultGPU = true;
'';
in
{
@ -41,5 +50,13 @@ in
steam-session
prismlauncher
# modrinth-app
(lutris.override {
extraLibraries = pkgs: [
# List library dependencies here
];
extraPkgs = pkgs: [
# List package dependencies here
];
})
];
}

View file

@ -1,15 +1,20 @@
{ pkgs, ... }:
{ pkgs, inputs, ... }:
{
# sound.enable = true; #deprecated in 24.11 TODO remove this line when 24.11 release
imports = [
inputs.nix-gaming.nixosModules.pipewireLowLatency
];
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
wireplumber.enable = true;
jack.enable = true;
lowLatency.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)
@ -19,6 +24,7 @@
environment.systemPackages = builtins.attrValues {
inherit (pkgs)
playerctl # cli utility and lib for controlling media players
pavucontrol
# pamixer # cli pulseaudio sound mixer
;
};

View file

@ -1,4 +1,9 @@
{ pkgs, ... }:
{
pkgs,
lib,
config,
...
}:
{
hardware.xone.enable = true; # xbox controller
@ -9,6 +14,7 @@
enable = true;
package = pkgs.protontricks;
};
package = pkgs.steam.override {
extraPkgs =
pkgs:
@ -31,10 +37,12 @@
libkrb5
keyutils
gperftools
gamemode
;
});
};
extraCompatPackages = [ pkgs.unstable.proton-ge-bin ];
gamescopeSession.enable = true;
};
#gamescope launch args set dynamically in home/<user>/common/optional/gaming
gamescope = {
@ -48,8 +56,9 @@
settings = {
#see gamemode man page for settings info
general = {
softrealtime = "on";
softrealtime = "auto";
inhibit_screensaver = 1;
renice = 15;
};
gpu = {
apply_gpu_optimisations = "accept-responsibility";

View file

@ -32,10 +32,11 @@ in
"wheel"
(ifTheyExist [
"audio"
"video"
"docker"
"gamemode"
"git"
"networkmanager"
"video"
])
];
};