mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-25 10:18:37 +02:00
chore: install ai stuff(ollama) & games(steam) only on idols-ai
This commit is contained in:
60
hosts/idols-ai/game/gamemode.nix
Normal file
60
hosts/idols-ai/game/gamemode.nix
Normal file
@@ -0,0 +1,60 @@
|
||||
# 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 {
|
||||
# Optimise Linux system performance on demand
|
||||
# https://github.com/FeralInteractive/GameMode
|
||||
# https://wiki.archlinux.org/title/Gamemode
|
||||
#
|
||||
# Usage:
|
||||
# 1. For games/launchers which integrate GameMode support:
|
||||
# https://github.com/FeralInteractive/GameMode#apps-with-gamemode-integration
|
||||
# simply running the game will automatically activate GameMode.
|
||||
# 2. For others, launching the game through gamemoderun: `gamemoderun ./game`
|
||||
# 3. For steam: `gamemoderun steam-runtime`
|
||||
programs.gamemode = {
|
||||
enable = pkgs.stdenv.isx86_64;
|
||||
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;
|
||||
programs.steam.platformOptimizations.enable = true;
|
||||
imports = with nix-gaming.nixosModules; [
|
||||
pipewireLowLatency
|
||||
platformOptimizations
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user