diff --git a/hosts/ocean-desktop/configuration.nix b/hosts/ocean-desktop/configuration.nix index 79551ca..9461b88 100755 --- a/hosts/ocean-desktop/configuration.nix +++ b/hosts/ocean-desktop/configuration.nix @@ -12,6 +12,7 @@ switch = true; wii = true; }; + utils.overlays.vkbasalt = true; }; awesome = { enable = true; @@ -36,6 +37,24 @@ ''; }; + programs.alvr = { + enable = true; + openFirewall = true; + }; + + # required for NixOS SteamVR to work + # https://wiki.nixos.org/wiki/VR/en#SteamVR + boot.kernelPatches = [ + { + name = "amdgpu-ignore-ctx-privileges"; + patch = pkgs.fetchpatch { + name = "cap_sys_nice_begone.patch"; + url = "https://github.com/Frogging-Family/community-patches/raw/master/linux61-tkg/cap_sys_nice_begone.mypatch"; + hash = "sha256-Y3a0+x2xvHsfLax/uwycdJf3xLxvVfkfDVqjkxNaYEo="; + }; + } + ]; + #services.davfs2 = { # enable = true; # settings.sections = { @@ -60,6 +79,16 @@ # #"async" # ?? # ]; #}; + + fileSystems."/tmp" = { + device = "none"; + fsType = "tmpfs"; + options = [ + "defaults" + "size=150%" + ]; + }; + networking.firewall.allowedTCPPorts = [ 3216 # EA App ]; diff --git a/modules/desktop/gaming/emulation.nix b/modules/desktop/gaming/emulation.nix index ca55b64..7209c89 100755 --- a/modules/desktop/gaming/emulation.nix +++ b/modules/desktop/gaming/emulation.nix @@ -5,7 +5,7 @@ with lib; let cfg = config.modules.desktop.gaming.emulation; in { options.modules.desktop.gaming.emulation = { - enable = mkEnableOption "enable the emulation module"; + enable = mkEnableOption "the emulation module"; switch = mkEnableOption "Nintendo Switch"; gamecube = mkEnableOption "Nintendo GameCube"; wii = mkEnableOption "Nintendo Wii"; @@ -15,18 +15,10 @@ in { config = mkIf cfg.enable { - programs.gamemode = { - enable = true; - enableRenice = true; - }; + # some emulators support gamemode natively + modules.desktop.gaming.utils.gamemode = mkDefault true; - environment.systemPackages = with pkgs; [ - # helpful overlays and such - mangohud - vkbasalt - # a configurator for them - goverlay - ] + environment.systemPackages = [] ++ optional cfg.switch pkgs.ryujinx ++ optional (cfg.gamecube || cfg.wii) pkgs.dolphin-emu ++ optional cfg.primehack pkgs.dolphin-emu-primehack; diff --git a/modules/desktop/gaming/steam.nix b/modules/desktop/gaming/steam.nix index 40df715..414eca7 100755 --- a/modules/desktop/gaming/steam.nix +++ b/modules/desktop/gaming/steam.nix @@ -12,33 +12,26 @@ in { programs.steam = { enable = true; - remotePlay.openFirewall = true; - localNetworkGameTransfers.openFirewall = true; + remotePlay.openFirewall = mkDefault true; + localNetworkGameTransfers.openFirewall = mkDefault true; - # wayland thing + # makes Steam Input and such behave better under Wayland extest.enable = true; - protontricks.enable = true; - gamescopeSession.enable = true; + protontricks.enable = mkDefault true; + gamescopeSession.enable = mkDefault true; }; - programs.gamemode = { - enable = true; - enableRenice = true; - }; - - environment = { - sessionVariables.STEAM_EXTRA_COMPAT_TOOLS_PATHS = "\${HOME}/.steam/root/compatibilitytools.d"; + modules.desktop.gaming.utils = { + protonup = mkDefault true; - systemPackages = with pkgs; [ - protonup-qt - - # helpful overlays and such - mangohud - vkbasalt - # a configurator for them - goverlay - ]; + # both gamemode and mangohud will have to be enabled manually per game + gamemode = mkDefault true; + overlays.mangohud = mkDefault true; }; + + environment + .sessionVariables + .STEAM_EXTRA_COMPAT_TOOLS_PATHS = "\${HOME}/.steam/root/compatibilitytools.d"; }; } diff --git a/modules/desktop/gaming/utils..nix b/modules/desktop/gaming/utils..nix new file mode 100644 index 0000000..a4f5f96 --- /dev/null +++ b/modules/desktop/gaming/utils..nix @@ -0,0 +1,46 @@ + +{ config, pkgs, lib, inputs, system, ... }: + +with builtins; +with lib; +let + cfg = config.modules.desktop.gaming.utils; + # mkEnableOption, but you can set the default + mkEnableDefault = name: default: mkOption { + inherit default; + example = true; + description = "Whether to enable ${name}."; + type = types.bool; + }; + # or operation for a list - if a single value is true, return true + anyTrue = list: lists.any (x: x) list; + isSteamEnabled = config.modules.desktop.gaming.steam.enable; +in { + options.modules.desktop.gaming.utils = { + overlayConfigGUI = mkEnableDefault + "goverlay - a configurator for game overlays" + (anyTrue (attrsets.attrValues cfg.overlays)); + + overlays = { + mangohud = mkEnableOption "MangoHUD - FPS counter"; + vkbasalt = mkEnableOption "vkbasalt - shaders"; + }; + + protonup = mkEnableOption "protonup-qt - GUI manager for compatibility tools"; + + gamemode = mkEnableOption "gamemode for extra performance during games"; + }; + + config = { + programs.gamemode = mkIf cfg.gamemode { + enable = true; + enableRenice = mkDefault true; + }; + + environment.systemPackages = [] + ++ optional cfg.overlayConfigGUI pkgs.goverlay + ++ optional cfg.overlays.mangohud pkgs.mangohud + ++ optional cfg.overlays.vkbasalt pkgs.vkbasalt + ++ optional cfg.protonup pkgs.protonup-qt; + }; +} \ No newline at end of file