added stuff

This commit is contained in:
vali 2024-04-09 23:11:33 +02:00
commit 236b8c2a6b
907 changed files with 70990 additions and 0 deletions

View file

@ -0,0 +1,7 @@
{
imports = [
./gamescope.nix
./gamemode.nix
./steam.nix
];
}

View file

@ -0,0 +1,75 @@
{
inputs,
config,
pkgs,
lib,
...
}: let
inherit (lib) mkIf makeBinPath optionalString;
inherit (config) modules;
env = modules.usrEnv;
sys = modules.system;
prg = sys.programs;
programs = makeBinPath (with pkgs; [
inputs.hyprland.packages.${stdenv.system}.default
coreutils
power-profiles-daemon
systemd
libnotify
]);
startscript = pkgs.writeShellScript "gamemode-start" ''
${optionalString (env.desktop == "Hyprland") ''
export PATH=$PATH:${programs}
export HYPRLAND_INSTANCE_SIGNATURE=$(ls -w1 /tmp/hypr | tail -1)
hyprctl --batch 'keyword decoration:blur 0 ; keyword animations:enabled 0 ; keyword misc:vfr 0'
''}
powerprofilesctl set performance
notify-send -a 'Gamemode' 'Optimizations activated' -u 'low'
'';
endscript = pkgs.writeShellScript "gamemode-end" ''
${optionalString (env.desktop == "Hyprland") ''
export PATH=$PATH:${programs}
export HYPRLAND_INSTANCE_SIGNATURE=$(ls -w1 /tmp/hypr | tail -1)
hyprctl --batch 'keyword decoration:blur 1 ; keyword animations:enabled 1 ; keyword misc:vfr 1'
''}
powerprofilesctl set balanced
notify-send -a 'Gamemode' 'Optimizations deactivated' -u 'low'
'';
in {
config = mkIf prg.gaming.gamemode.enable {
programs.gamemode = {
enable = true;
enableRenice = true;
settings = {
general = {
softrealtime = "auto";
renice = 15;
};
custom = {
start = startscript.outPath;
end = endscript.outPath;
};
};
};
security.wrappers.gamemode = {
owner = "root";
group = "root";
source = "${pkgs.gamemode}/bin/gamemoderun";
capabilities = "cap_sys_ptrace,cap_sys_nice+pie";
};
boot.kernel.sysctl = {
# default on some gaming (SteamOS) and desktop (Fedora) distributions
# might help with gaming performance
"vm.max_map_count" = 2147483642;
};
};
}

View file

@ -0,0 +1,28 @@
{
config,
pkgs,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (config) modules;
sys = modules.system;
prg = sys.programs;
in {
config = mkIf prg.gaming.gamescope.enable {
programs.gamescope = {
enable = true;
package = pkgs.gamescope; # the default, here in case I want to override it
};
# workaround attempt for letting gamescope bypass YAMA LSM
# doesn't work, but doesn't hurt to keep this here
security.wrappers.gamescope = {
owner = "root";
group = "root";
source = "${config.programs.gamescope.package}/bin/gamescope";
capabilities = "cap_sys_ptrace,cap_sys_nice+pie";
};
};
}

View file

@ -0,0 +1,83 @@
{
config,
pkgs,
lib,
...
}: let
inherit (lib.modules) mkIf;
prg = config.modules.system.programs;
in {
config = mkIf prg.gaming.steam.enable {
nixpkgs = {
config = {
allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
"steam"
"steam-original"
"steam-runtime"
];
};
overlays = [
(_: prev: {
steam = prev.steam.override ({extraPkgs ? _: [], ...}: {
extraPkgs = pkgs':
(extraPkgs pkgs')
# Add missing dependencies
++ (with pkgs'; [
# Generic dependencies
libgdiplus
keyutils
libkrb5
libpng
libpulseaudio
libvorbis
stdenv.cc.cc.lib
xorg.libXcursor
xorg.libXi
xorg.libXinerama
xorg.libXScrnSaver
at-spi2-atk
fmodex
gtk3
gtk3-x11
harfbuzz
icu
glxinfo
inetutils
libthai
mono5
pango
stdenv.cc.cc.lib
strace
zlib
# for Titanfall 2 Northstar launcher
libunwind
]);
});
})
];
};
programs.steam = {
# Enable steam
enable = true;
# Whether to open ports in the firewall for Steam Remote Play
remotePlay.openFirewall = false;
# Whether to open ports in the firewall for Source Dedicated Server
dedicatedServer.openFirewall = false;
# Compatibility tools to install
# For the accepted format (and the reason behind)
# the "compattool" attribute, see:
# <https://github.com/NixOS/nixpkgs/pull/296009>
extraCompatPackages = [
pkgs.proton-ge-bin.steamcompattool
];
};
};
}