From 2551462ffeb24b0f089f3680503085dfab480f13 Mon Sep 17 00:00:00 2001 From: Krzysztof Saczuk Date: Sun, 19 May 2024 15:39:30 +0200 Subject: [PATCH] feat: add steam (#66) --- modules/desktop/apps/steam.nix | 23 +++++++++++++++++++++++ modules/desktop/wm/hyprland.nix | 3 +++ modules/hardware/amdgpu.nix | 13 ++++++++++--- modules/hardware/layout.nix | 5 ++++- 4 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 modules/desktop/apps/steam.nix diff --git a/modules/desktop/apps/steam.nix b/modules/desktop/apps/steam.nix new file mode 100644 index 0000000..8891fc8 --- /dev/null +++ b/modules/desktop/apps/steam.nix @@ -0,0 +1,23 @@ +{ + lib, + pkgs, + ... +}: +with lib; +with lib.my; { + environment = { + systemPackages = with pkgs; [mangohud steam-run]; + }; + + programs = { + gamescope.enable = true; + gamemode.enable = true; + steam = { + enable = true; + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; + gamescopeSession.enable = true; + extraCompatPackages = with pkgs; [proton-ge-bin]; + }; + }; +} diff --git a/modules/desktop/wm/hyprland.nix b/modules/desktop/wm/hyprland.nix index bc0a635..4561a3b 100644 --- a/modules/desktop/wm/hyprland.nix +++ b/modules/desktop/wm/hyprland.nix @@ -24,6 +24,7 @@ in "gtk" "qt" "grimblast" + "steam" ]; extraConfig = { @@ -40,6 +41,8 @@ in # Make chrome and electron apps run native on wayland environment.sessionVariables.NIXOS_OZONE_WL = "1"; + xdg.portal.extraPortals = with pkgs; [xdg-desktop-portal-gtk]; + home-manager.users.${username} = { # TODO: Move this and media controls to an app config for a player script home.packages = with pkgs; [playerctl]; diff --git a/modules/hardware/amdgpu.nix b/modules/hardware/amdgpu.nix index 37b1e71..7860f71 100644 --- a/modules/hardware/amdgpu.nix +++ b/modules/hardware/amdgpu.nix @@ -12,9 +12,16 @@ in { }; config = mkIf (cfg.enable) { - services.xserver.videoDrivers = mkIf config.services.xserver.enable ["amdgpu"]; - - hardware.enableRedistributableFirmware = true; + services.xserver.videoDrivers = ["amdgpu"]; boot.initrd.kernelModules = ["amdgpu"]; + + hardware = { + enableRedistributableFirmware = true; + opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + }; }; } diff --git a/modules/hardware/layout.nix b/modules/hardware/layout.nix index 6001fee..7c7385f 100644 --- a/modules/hardware/layout.nix +++ b/modules/hardware/layout.nix @@ -238,7 +238,10 @@ in { }) cfg.layout; in { - deviceSection = concatLines (builtins.map (x: ''Option "monitor-${x.layout.monitor.xorg}" "${x.name}"'') heads); + deviceSection = concatLines ( + (builtins.map (x: ''Option "monitor-${x.layout.monitor.xorg}" "${x.name}"'') heads) + ++ [''Option "DRI" "3"''] + ); extraConfig = with lib; let mkMonitorSection = prev: curr: (singleton {