gamer improvements

This commit is contained in:
notgne2 2022-05-14 08:58:40 -07:00
parent b0418eb56f
commit 4b500953fd
Signed by: notgne2
GPG Key ID: 5CE0A245A2DAC84A
3 changed files with 75 additions and 14 deletions

View File

@ -24,6 +24,14 @@ in
enable = lib.mkDefault true; enable = lib.mkDefault true;
}; };
home.packages = with pkgs; [
ark
unzip
unrar
mpv
];
xsession.enable = true; xsession.enable = true;
xsession.windowManager.i3 = { xsession.windowManager.i3 = {
enable = true; enable = true;

View File

@ -72,9 +72,32 @@ in
default = false; default = false;
description = "If you want to include wine-staging as new-wine"; description = "If you want to include wine-staging as new-wine";
}; };
sunshineService = mkOption {
type = types.bool;
description = "Enable sunshine game streaming service";
};
steamService = mkOption {
type = types.bool;
description = "Enable running steam as a service";
};
scService = mkOption {
type = types.bool;
description = "Enable running sc-controller as a service. This integrates with steamService to make sure your steam controller will continuously be mapped.";
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
gaming.sunshineService = mkOptionDefault false;
gaming.steamService = mkOptionDefault cfg.sunshineService;
gaming.scService = mkOptionDefault cfg.steamService;
home.sessionVariables = {
STAGING_RT_PRIORITY_SERVER = 90;
};
home.packages = home.packages =
let let
newwine = (pkgs.wineFull.override { wineBuild = "wineWow"; wineRelease = "staging"; }); newwine = (pkgs.wineFull.override { wineBuild = "wineWow"; wineRelease = "staging"; });
@ -101,17 +124,10 @@ in
oldwine oldwine
oldwinetricks oldwinetricks
(pkgs.writeShellScriptBin "steam" "${pkgs.systemd}/bin/systemctl --user start steam")
sc-controller sc-controller
dolphinEmuMaster dolphinEmuMaster
ark
unzip
unrar
mpv
tuxpaint tuxpaint
extremetuxracer extremetuxracer
@ -125,9 +141,9 @@ in
ln -s ${newwinetricks}/bin/winetricks $out/bin/new-winetricks ln -s ${newwinetricks}/bin/winetricks $out/bin/new-winetricks
'' ''
) )
]; ] ++ lib.optional cfg.steamService (pkgs.writeShellScriptBin "steam" "${pkgs.systemd}/bin/systemctl --user start steam");
systemd.user.services.sunshine = { systemd.user.services.sunshine = mkIf cfg.sunshineService {
Unit = { Unit = {
Description = "Host for Moonlight Streaming Client"; Description = "Host for Moonlight Streaming Client";
Requires = [ "dbus.service" ]; Requires = [ "dbus.service" ];
@ -162,7 +178,7 @@ in
}; };
}; };
systemd.user.services.scc = { systemd.user.services.scc = mkIf cfg.scSerice {
Unit = { Unit = {
Description = "User-mode driver and GTK3 based GUI for Steam Controller"; Description = "User-mode driver and GTK3 based GUI for Steam Controller";
After = [ "graphical-session-pre.target" ]; After = [ "graphical-session-pre.target" ];
@ -179,7 +195,7 @@ in
Install = { WantedBy = [ "graphical-session.target" ]; }; Install = { WantedBy = [ "graphical-session.target" ]; };
}; };
systemd.user.services.steam = { systemd.user.services.steam = mkIf cfg.steamService {
Unit = { Unit = {
Description = "Start Steam gaming platform"; Description = "Start Steam gaming platform";
After = [ "graphical-session-pre.target" ]; After = [ "graphical-session-pre.target" ];
@ -196,7 +212,7 @@ in
/run/current-system/sw/bin/steam -fulldesktopres /run/current-system/sw/bin/steam -fulldesktopres
''; '';
in in
"${steamStart}"; lib.mkIf cfg.scService "${steamStart}";
ExecStop = ExecStop =
let let
steamStop = pkgs.writeShellScript "steam-stop" '' steamStop = pkgs.writeShellScript "steam-stop" ''
@ -204,7 +220,7 @@ in
${pkgs.systemd}/bin/systemctl --user start scc ${pkgs.systemd}/bin/systemctl --user start scc
''; '';
in in
"${steamStop}"; lib.mkIf cfg.scService "${steamStop}";
}; };
Install = { WantedBy = [ "graphical-session.target" ]; }; Install = { WantedBy = [ "graphical-session.target" ]; };

View File

@ -106,15 +106,52 @@ in
# Needed for lots of controller stuff # Needed for lots of controller stuff
hardware.uinput.enable = lib.mkDefault true; hardware.uinput.enable = lib.mkDefault true;
# proton esync # Allows realtime stuff, useful for games, audio etc
services.udev.extraRules = ''
KERNEL=="rtc0", GROUP="users"
KERNEL=="hpet", GROUP="users"
'';
# Allows more open files, useful for sync software and some other stuff
systemd.extraConfig = "DefaultLimitNOFILE=1048576"; systemd.extraConfig = "DefaultLimitNOFILE=1048576";
security.pam.loginLimits = [ security.pam.loginLimits = [
# Allows more open files, useful for sync software and some other stuff
{
domain = "*";
type = "soft";
item = "nofile";
value = "1048576";
}
{ {
domain = "*"; domain = "*";
type = "hard"; type = "hard";
item = "nofile"; item = "nofile";
value = "1048576"; value = "1048576";
} }
# Allows more locked memory, useful for emulators, some games, etc
{
domain = "@users";
type = "-";
item = "memlock";
value = "unlimited";
}
# Allows greater realtime priority, useful for audio, emulators, games, etc
{
domain = "@users";
type = "-";
item = "rtprio";
value = "90";
}
# Allow becoming less nice, useful for audio, emulators, games, etc
{
domain = "@users";
type = "-";
item = "nice";
value = "-10";
}
]; ];
# the user should have some basic permissions lol # the user should have some basic permissions lol