feat: gaming - gamemode + stream

This commit is contained in:
Ryan Yin
2024-01-22 22:00:14 +08:00
parent 9843ea9db5
commit 40921d4199
10 changed files with 205 additions and 19 deletions

View File

@@ -0,0 +1,3 @@
{mylib, ...}: {
imports = mylib.scanPaths ./.;
}

View File

@@ -0,0 +1,48 @@
# https://github.com/fufexan/dotfiles/blob/483680e121b73db8ed24173ac9adbcc718cbbc6e/system/programs/gamemode.nix
{
config,
pkgs,
nix-gaming,
lib,
...
}: let
programs = lib.makeBinPath [
config.programs.hyprland.package
pkgs.coreutils
pkgs.power-profiles-daemon
];
startscript = pkgs.writeShellScript "gamemode-start" ''
export PATH=$PATH:${programs}
export HYPRLAND_INSTANCE_SIGNATURE=$(ls -1 /tmp/hypr | tail -1)
hyprctl --batch 'keyword decoration:blur 0 ; keyword animations:enabled 0 ; keyword misc:vfr 0'
powerprofilesctl set performance
'';
endscript = pkgs.writeShellScript "gamemode-end" ''
export PATH=$PATH:${programs}
export HYPRLAND_INSTANCE_SIGNATURE=$(ls -1 /tmp/hypr | tail -1)
hyprctl --batch 'keyword decoration:blur 1 ; keyword animations:enabled 1 ; keyword misc:vfr 1'
powerprofilesctl set power-saver
'';
in {
programs.gamemode = {
enable = true;
settings = {
general = {
softrealtime = "auto";
renice = 15;
};
custom = {
start = startscript.outPath;
end = endscript.outPath;
};
};
};
# see https://github.com/fufexan/nix-gaming/#pipewire-low-latency
services.pipewire.lowLatency.enable = true;
imports = [
nix-gaming.nixosModules.pipewireLowLatency
];
}

View File

@@ -0,0 +1,30 @@
# https://github.com/fufexan/dotfiles/blob/483680e/system/programs/steam.nix
{pkgs, ...}: {
# https://wiki.archlinux.org/title/steam
programs.steam = {
# steam will be installed into ~/.local/share/Steam
# the games will be installed into ~/.local/share/Steam/steamapps/common
enable = true;
# fix gamescope inside steam
package = pkgs.steam.override {
extraPkgs = pkgs:
with pkgs; [
keyutils
libkrb5
libpng
libpulseaudio
libvorbis
stdenv.cc.cc.lib
xorg.libXcursor
xorg.libXi
xorg.libXinerama
xorg.libXScrnSaver
];
};
};
fonts.packages = with pkgs; [
wqy_zenhei # Need by steam for Chinese
];
}

View File

@@ -12,10 +12,10 @@
enable = true;
# https://guix.gnu.org/en/manual/en/html_node/Invoking-guix-gc.html
extraArgs = [
"--delete-generations=1m"
"--free-space=10G"
"--optimize"
];
"--delete-generations=1m"
"--free-space=10G"
"--optimize"
];
};
};
}

View File

@@ -15,7 +15,7 @@
# gpg agent with pinentry
programs.gnupg.agent = {
enable = true;
pinentryFlavor = "curses";
pinentryFlavor = "curses";
enableSSHSupport = false;
};
}