diff --git a/machines/playman/profiles.nix b/machines/playman/profiles.nix index 9b7d573..603eb7b 100644 --- a/machines/playman/profiles.nix +++ b/machines/playman/profiles.nix @@ -3,7 +3,10 @@ _: { my.profiles = { clean.enable = true; development.enable = true; - gaming.enable = true; + gaming = { + enable = true; + gamescope.enable = true; + }; nix.enable = true; sync.enable = true; update.enable = true; diff --git a/profiles/gaming/default.nix b/profiles/gaming/default.nix index 51d70ec..664f297 100644 --- a/profiles/gaming/default.nix +++ b/profiles/gaming/default.nix @@ -10,40 +10,83 @@ in { options.my.profiles.gaming = with lib; { enable = mkEnableOption "gaming profile"; - }; - config = lib.mkIf cfg.enable { - environment.systemPackages = with pkgs; [ - blobby - discord - gamemode - luanti - moonlight-qt # steam-link stream - openttd - prismlauncher # replace minecraft - SDL - SDL2 - steam - superTuxKart - wine - winetricks - ]; - - programs.steam = { - enable = true; - # fix gamemode: https://github.com/NixOS/nixpkgs/issues/389142 - package = pkgs.steam.override { - extraPkgs = - pkgs: with pkgs; [ - gamemode - ]; + gamescope = { + enable = mkEnableOption "gamescope profile"; + username = mkOption { + type = types.str; + default = "felix"; + description = "Username for gamescope autologin"; }; }; - - hardware = { - graphics.enable32Bit = true; - graphics.extraPackages32 = with pkgs.pkgsi686Linux; [ libva ]; - }; - services.pulseaudio.support32Bit = true; }; + + config = lib.mkIf cfg.enable ( + + lib.mkMerge [ + { + environment.systemPackages = with pkgs; [ + blobby + discord + gamemode + luanti + mangohud + moonlight-qt # steam-link stream + openttd + prismlauncher # replace minecraft + SDL + SDL2 + steam + superTuxKart + wine + winetricks + ]; + + programs.steam = { + enable = true; + # remotePlay.openFirewall = cfg.gamescope.enable; + # fix gamemode: https://github.com/NixOS/nixpkgs/issues/389142 + package = pkgs.steam.override { + extraPkgs = + pkgs: with pkgs; [ + gamemode + ]; + }; + }; + + hardware = { + graphics.enable32Bit = true; + graphics.extraPackages32 = with pkgs.pkgsi686Linux; [ libva ]; + }; + + services.pulseaudio.support32Bit = true; + } + + (lib.mkIf cfg.gamescope.enable { + programs = { + gamescope = { + enable = true; + capSysNice = true; + }; + steam.gamescopeSession.enable = true; + }; + + services = { + xserver.enable = false; + + getty.autologinUser = cfg.gamescope.username; + + greetd = { + enable = true; + settings = { + default_session = { + command = "${lib.getExe pkgs.gamescope} -W 1920 -H 1080 -f -e --xwayland-count 2 --hdr-enabled --hdr-itm-enabled -- ${lib.getExe config.programs.steam.package} -pipewire-dmabuf -gamepadui -steamos3 > /dev/null 2>&1"; + user = cfg.gamescope.username; + }; + }; + }; + }; + }) + ] + ); }