From 89354f803266a4cbe30ff871c133b29f4354f135 Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Fri, 16 Jun 2023 21:38:39 -0400 Subject: [PATCH] Use gamescope from git --- modules/linux/programs/games.nix | 44 ++++++++++++++++++-------------- sources/gamescope.json | 4 +++ sources/update-sources.sh | 12 +++++++++ 3 files changed, 41 insertions(+), 19 deletions(-) create mode 100644 sources/gamescope.json diff --git a/modules/linux/programs/games.nix b/modules/linux/programs/games.nix index d1d911e..c8d5250 100644 --- a/modules/linux/programs/games.nix +++ b/modules/linux/programs/games.nix @@ -13,7 +13,6 @@ in with lib; { }) # Prism Launcher minecraft stuff glfw-patched - gamescope ]; unstable-packages = with inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}"; [ @@ -22,25 +21,32 @@ in with lib; { prismlauncher ]; in stable-packages ++ unstable-packages; + # Setup gamescope + programs.gamescope = { + enable = true; + package = pkgs.gamescope.overrideAttrs (old: { + src = let + vals = builtins.fromJSON + (builtins.readFile ../../../sources/gamescope.json); + in pkgs.fetchFromGitHub { + owner = "ValveSoftware"; + repo = "gamescope"; + rev = vals.rev; + hash = vals.hash; + fetchSubmodules = true; + }; + patches = [ ]; + buildInputs = with pkgs; + old.buildInputs + ++ [ glm xorg.xcbutilwm xorg.xcbutilerrors gbenchmark ]; + }); + }; # Install steam - programs.steam.enable = true; - # Make steam work with gamescope - nixpkgs.config.packageOverrides = pkgs: { - steam = pkgs.steam.override { - extraPkgs = pkgs: - with pkgs; [ - xorg.libXcursor - xorg.libXi - xorg.libXinerama - xorg.libXScrnSaver - libpng - libpulseaudio - libvorbis - stdenv.cc.cc.lib - libkrb5 - keyutils - gtk3 - ]; + programs.steam = { + enable = true; + gamescopeSession = { + enable = true; + args = [ "--rt" ]; }; }; }; diff --git a/sources/gamescope.json b/sources/gamescope.json new file mode 100644 index 0000000..360cca2 --- /dev/null +++ b/sources/gamescope.json @@ -0,0 +1,4 @@ +{ + "rev": "789cfc90575a7dbfc61ffa3325a4fb7f59f4d8b5", + "hash": "sha256-ThirEuHlxTTd2T8kuPTcDohMv7N7ZoSyWt0tzjpN6A0=" +} diff --git a/sources/update-sources.sh b/sources/update-sources.sh index a4bfbbc..0fd0aaf 100755 --- a/sources/update-sources.sh +++ b/sources/update-sources.sh @@ -15,3 +15,15 @@ jq --null-input \ '{"version": $version, "url": $url, "hash": $hash}' \ > $DIRECTORY/swayimg.json echo "swayimg now at $SWAYIMG_VERSION" + +# Update gamescope +GAMESCOPE_BRANCH=$(curl https://api.github.com/repos/ValveSoftware/gamescope | jq -r '.default_branch') +GAMESCOPE_REV=$(curl https://api.github.com/repos/ValveSoftware/gamescope/git/refs/heads/$GAMESCOPE_BRANCH | \ + jq -r '.object.sha') +GAMESCOPE_HASH=$(nix-prefetch fetchFromGitHub --owner ValveSoftware --repo gamescope --rev $GAMESCOPE_REV --fetchSubmodules) +jq --null-input \ + --arg rev "$GAMESCOPE_REV" \ + --arg hash "$GAMESCOPE_HASH" \ + '{"rev": $rev, "hash": $hash}' \ + > $DIRECTORY/gamescope.json +echo "gamescope now at $GAMESCOPE_REV"