diff --git a/home-manager/modules/gamerenv.nix b/home-manager/modules/gamerenv.nix index 6319d74..4bac07e 100644 --- a/home-manager/modules/gamerenv.nix +++ b/home-manager/modules/gamerenv.nix @@ -24,6 +24,14 @@ in enable = lib.mkDefault true; }; + home.packages = with pkgs; [ + ark + unzip + unrar + + mpv + ]; + xsession.enable = true; xsession.windowManager.i3 = { enable = true; diff --git a/home-manager/modules/gaming.nix b/home-manager/modules/gaming.nix index 00b82ae..daa1c42 100644 --- a/home-manager/modules/gaming.nix +++ b/home-manager/modules/gaming.nix @@ -72,9 +72,32 @@ in default = false; 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 { + gaming.sunshineService = mkOptionDefault false; + gaming.steamService = mkOptionDefault cfg.sunshineService; + gaming.scService = mkOptionDefault cfg.steamService; + + home.sessionVariables = { + STAGING_RT_PRIORITY_SERVER = 90; + }; + home.packages = let newwine = (pkgs.wineFull.override { wineBuild = "wineWow"; wineRelease = "staging"; }); @@ -101,17 +124,10 @@ in oldwine oldwinetricks - (pkgs.writeShellScriptBin "steam" "${pkgs.systemd}/bin/systemctl --user start steam") sc-controller dolphinEmuMaster - ark - unzip - unrar - - mpv - tuxpaint extremetuxracer @@ -125,9 +141,9 @@ in 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 = { Description = "Host for Moonlight Streaming Client"; Requires = [ "dbus.service" ]; @@ -162,7 +178,7 @@ in }; }; - systemd.user.services.scc = { + systemd.user.services.scc = mkIf cfg.scSerice { Unit = { Description = "User-mode driver and GTK3 based GUI for Steam Controller"; After = [ "graphical-session-pre.target" ]; @@ -179,7 +195,7 @@ in Install = { WantedBy = [ "graphical-session.target" ]; }; }; - systemd.user.services.steam = { + systemd.user.services.steam = mkIf cfg.steamService { Unit = { Description = "Start Steam gaming platform"; After = [ "graphical-session-pre.target" ]; @@ -196,7 +212,7 @@ in /run/current-system/sw/bin/steam -fulldesktopres ''; in - "${steamStart}"; + lib.mkIf cfg.scService "${steamStart}"; ExecStop = let steamStop = pkgs.writeShellScript "steam-stop" '' @@ -204,7 +220,7 @@ in ${pkgs.systemd}/bin/systemctl --user start scc ''; in - "${steamStop}"; + lib.mkIf cfg.scService "${steamStop}"; }; Install = { WantedBy = [ "graphical-session.target" ]; }; diff --git a/modules/workstation.nix b/modules/workstation.nix index 5cf322d..41b316a 100644 --- a/modules/workstation.nix +++ b/modules/workstation.nix @@ -106,15 +106,52 @@ in # Needed for lots of controller stuff 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"; security.pam.loginLimits = [ + # Allows more open files, useful for sync software and some other stuff + { + domain = "*"; + type = "soft"; + item = "nofile"; + value = "1048576"; + } { domain = "*"; type = "hard"; item = "nofile"; 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