refactor: modularize gaming module and fold in hamachi

This commit is contained in:
Youwen Wu 2024-12-22 22:32:50 -08:00
parent ee6f29eb57
commit ddfcbd78c8
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
3 changed files with 64 additions and 49 deletions

View file

@ -1,55 +1,75 @@
{ pkgs, ... }:
{ {
environment.systemPackages = with pkgs; [ pkgs,
ryujinx lib,
mangohud config,
mangojuice ...
]; }:
programs.steam = { let
enable = true; cfg = config.liminalOS.extras.gaming;
remotePlay.openFirewall = true; in
dedicatedServer.openFirewall = true; {
localNetworkGameTransfers.openFirewall = true; options.liminalOS.extras.gaming = {
gamescopeSession.enable = true; enable = lib.mkEnableOption "gaming";
withHamachi = lib.mkEnableOption "hamachi";
}; };
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
ryujinx
lutris
heroic
mangohud
mangojuice
];
programs.gamescope.enable = true; programs.steam = {
enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
localNetworkGameTransfers.openFirewall = true;
gamescopeSession.enable = true;
};
programs.gamemode = { programs.gamescope.enable = true;
enable = true;
enableRenice = true; programs.gamemode = {
settings = { enable = true;
general = { enableRenice = true;
renice = 10; settings = {
}; general = {
custom = { renice = 10;
start = "${pkgs.libnotify}/bin/notify-send 'GameMode engaged'"; };
end = "${pkgs.libnotify}/bin/notify-send 'GameMode disengaged'"; custom = {
start = "${pkgs.libnotify}/bin/notify-send 'GameMode engaged'";
end = "${pkgs.libnotify}/bin/notify-send 'GameMode disengaged'";
};
}; };
}; };
};
users.users.youwen.extraGroups = [ "gamemode" ]; users.users.${config.liminalOS.username}.extraGroups = [ "gamemode" ];
nixpkgs.config.packageOverrides = pkgs: { services.logmein-hamachi.enable = cfg.withHamachi;
steam = pkgs.steam.override { programs.haguichi.enable = cfg.withHamachi;
extraPkgs =
pkgs: with pkgs; [ nixpkgs.config.packageOverrides = pkgs: {
xorg.libXcursor steam = pkgs.steam.override {
xorg.libXi extraPkgs =
xorg.libXinerama pkgs: with pkgs; [
xorg.libXScrnSaver xorg.libXcursor
libpng xorg.libXi
libpulseaudio xorg.libXinerama
libvorbis xorg.libXScrnSaver
stdenv.cc.cc.lib libpng
libkrb5 libpulseaudio
(writeShellScriptBin "launch-gamescope" '' libvorbis
(sleep 1; pgrep gamescope| xargs renice -n -11 -p)& stdenv.cc.cc.lib
exec gamescope "$@" libkrb5
'') (writeShellScriptBin "launch-gamescope" ''
keyutils (sleep 1; pgrep gamescope| xargs renice -n -11 -p)&
]; exec gamescope "$@"
'')
keyutils
];
};
}; };
}; };
} }

View file

@ -1,4 +0,0 @@
{
services.logmein-hamachi.enable = true;
programs.haguichi.enable = true;
}

View file

@ -12,7 +12,6 @@ in
++ (with pkgs; [ ++ (with pkgs; [
bitwarden-desktop bitwarden-desktop
modrinth-app modrinth-app
lutris
sbctl sbctl
r2modman r2modman
zoom-us zoom-us