diff --git a/features/gaming.nix b/features/gaming.nix index 496cb5d..c00f557 100644 --- a/features/gaming.nix +++ b/features/gaming.nix @@ -3,7 +3,8 @@ protonup-qt vesktop lutris - gamescope-old + gamescope-dbg + wine ]; programs.steam = { diff --git a/flake.nix b/flake.nix index ba2f0b9..2407411 100644 --- a/flake.nix +++ b/flake.nix @@ -65,6 +65,7 @@ { kickoff-dot-desktop = pkgs.callPackage ./pkgs/kickoff-dot-desktop.nix { }; gamescope-old = pkgs.callPackage ./pkgs/gamescope-old {}; + gamescope-dbg = pkgs.callPackage ./pkgs/gamescope-dbg {}; } ); }; diff --git a/hosts/ankaa/home.nix b/hosts/ankaa/home.nix index 9b006fc..32621da 100644 --- a/hosts/ankaa/home.nix +++ b/hosts/ankaa/home.nix @@ -38,9 +38,9 @@ gtk = { enable = true; - cursorTheme = { - name = "phinger-cursors-dark"; - package = pkgs.phinger-cursors; + iconTheme = { + name = "awaida-dark"; + package = pkgs.gnome.adwaita-icon-theme; }; theme = { name = "adw-gtk3-dark"; diff --git a/pkgs/gamescope-dbg/default.nix b/pkgs/gamescope-dbg/default.nix new file mode 100644 index 0000000..8e3db40 --- /dev/null +++ b/pkgs/gamescope-dbg/default.nix @@ -0,0 +1,166 @@ +{ stdenv +, fetchFromGitHub +, libgcc +, meson +, pkg-config +, ninja +, xorg +, libdrm +, libei +, vulkan-loader +, vulkan-headers +, wayland +, wayland-protocols +, libxkbcommon +, glm +, gbenchmark +, libcap +, libavif +, SDL2 +, pipewire +, pixman +, libinput +, glslang +, hwdata +, openvr +, stb +, wlroots +, libliftoff +, libdecor +, libdisplay-info +, lib +, makeBinaryWrapper +, patchelfUnstable +, nix-update-script +, enableExecutable ? true +, enableWsi ? true +}: +let + joshShaders = fetchFromGitHub { + owner = "Joshua-Ashton"; + repo = "GamescopeShaders"; + rev = "v0.1"; + hash = "sha256-gR1AeAHV/Kn4ntiEDUSPxASLMFusV6hgSGrTbMCBUZA="; + }; +in +stdenv.mkDerivation (finalAttrs: { + pname = "gamescope"; + version = "3.14.16"; + + src = fetchFromGitHub { + owner = "ValveSoftware"; + repo = "gamescope"; + rev = "0065946d1bf69584714a17698947ab80a97128bc"; + fetchSubmodules = true; + hash = "sha256-PiDXHq7/CxIOday5DQyAG6i3+ggm6zp3iSPIhq63EOk="; + }; + + patches = [ + # Unvendor dependencies + ./use-pkgconfig.patch + + # Make it look for shaders in the right place + ./shaders-path.patch + ]; + + # We can't substitute the patch itself because substituteAll is itself a derivation, + # so `placeholder "out"` ends up pointing to the wrong place + postPatch = '' + substituteInPlace src/reshade_effect_manager.cpp --replace "@out@" "$out" + ''; + + + mesonFlags = [ + (lib.mesonBool "enable_gamescope" enableExecutable) + (lib.mesonBool "enable_gamescope_wsi_layer" enableWsi) + "-Dc_args=-fsanitize-recover=address" + "-Dc_link_args=-fsanitize-recover=address" + "-Dcpp_args=-fsanitize-recover=address" + "-Dcpp_link_args=-fsanitize-recover=address" + "--buildtype=debugoptimized" + "-Db_sanitize=address" + ]; + + # don't install vendored vkroots etc + mesonInstallFlags = ["--skip-subprojects"]; + + strictDeps = true; + dontStrip = true; + + depsBuildBuild = [ + pkg-config + ]; + + nativeBuildInputs = [ + meson + pkg-config + ninja + ] ++ lib.optionals enableExecutable [ + makeBinaryWrapper + glslang + ]; + + buildInputs = [ + pipewire + hwdata + xorg.libX11 + wayland + wayland-protocols + vulkan-loader + openvr + glm + ] ++ lib.optionals enableWsi [ + vulkan-headers + ] ++ lib.optionals enableExecutable (wlroots.buildInputs ++ [ # gamescope uses a custom wlroots branch + xorg.libXcomposite + xorg.libXcursor + xorg.libXdamage + xorg.libXext + xorg.libXi + xorg.libXmu + xorg.libXrender + xorg.libXres + xorg.libXtst + xorg.libXxf86vm + libavif + libdrm + libei + libliftoff + SDL2 + libdecor + libinput + libxkbcommon + gbenchmark + pixman + libcap + stb + libdisplay-info + ]); + + postInstall = lib.optionalString enableExecutable '' + # using patchelf unstable because the stable version corrupts the binary + ${lib.getExe patchelfUnstable} $out/bin/gamescope \ + --add-rpath ${vulkan-loader}/lib \ + --add-needed ${libgcc.lib}/lib/libasan.so.8 \ + --add-needed libvulkan.so.1 + + # --debug-layers flag expects these in the path + wrapProgram "$out/bin/gamescope" \ + --prefix PATH : ${with xorg; lib.makeBinPath [xprop xwininfo]} + + # Install ReShade shaders + mkdir -p $out/share/gamescope/reshade + cp -r ${joshShaders}/* $out/share/gamescope/reshade/ + ''; + + passthru.updateScript = nix-update-script {}; + + meta = with lib; { + description = "SteamOS session compositing window manager"; + homepage = "https://github.com/ValveSoftware/gamescope"; + license = licenses.bsd2; + maintainers = with maintainers; [ nrdxp pedrohlc Scrumplex zhaofengli k900 ]; + platforms = platforms.linux; + mainProgram = "gamescope"; + }; +}) diff --git a/pkgs/gamescope-dbg/shaders-path.patch b/pkgs/gamescope-dbg/shaders-path.patch new file mode 100644 index 0000000..bbdaf21 --- /dev/null +++ b/pkgs/gamescope-dbg/shaders-path.patch @@ -0,0 +1,13 @@ +diff --git a/src/reshade_effect_manager.cpp b/src/reshade_effect_manager.cpp +index 3597ca1..de45250 100644 +--- a/src/reshade_effect_manager.cpp ++++ b/src/reshade_effect_manager.cpp +@@ -34,7 +34,7 @@ static std::string GetLocalUsrDir() + + static std::string GetUsrDir() + { +- return "/usr"; ++ return "@out@"; + } + + static LogScope reshade_log("gamescope_reshade"); diff --git a/pkgs/gamescope-dbg/use-pkgconfig.patch b/pkgs/gamescope-dbg/use-pkgconfig.patch new file mode 100644 index 0000000..2b4de54 --- /dev/null +++ b/pkgs/gamescope-dbg/use-pkgconfig.patch @@ -0,0 +1,9 @@ +--- a/meson.build ++++ b/meson.build +@@ -6,7 +6,6 @@ project( + default_options: [ + 'cpp_std=c++20', + 'warning_level=2', +- 'force_fallback_for=wlroots,libliftoff,vkroots', + ], + )