Add proton-cachyos package and update gamescope-run steam wrapper to use the properly configured steam executable
Some checks are pending
Build NixOS ISOs (x86 only) / build-iso (x86, desktop) (push) Waiting to run
Build NixOS ISOs (x86 only) / build-iso (x86, server) (push) Waiting to run
Build NixOS ISOs (x86 only) / create-release (push) Blocked by required conditions

This commit is contained in:
Chris Toph 2025-06-29 03:03:41 -04:00
parent a1d0ce1bb1
commit 93dc3db7a5
5 changed files with 125 additions and 6 deletions

View file

@ -2,9 +2,10 @@
## This is only configured for AMD GPUs; Nvidia might require additional configuration.
## For example host (PC) configuration using this module go to home/hosts/rune
{
pkgs,
config,
lib,
osConfig,
pkgs,
...
}:
let
@ -34,6 +35,11 @@ let
set -x XCURSOR_THEME '${cursorTheme}'
set -x XCURSOR_PATH '${cursorPackage}/share/icons'
# Wayland specific environment variables
# set -x PROTON_USE_SDL 1
set -x PROTON_USE_WAYLAND 1
set -x PROTON_ENABLE_HDR 1
# Gamescope display identifier
set -x GAMESCOPE_WAYLAND_DISPLAY "gamescope-0"
@ -119,18 +125,22 @@ let
set -a final_args (string split ' ' -- $GAMESCOPE_EXTRA_OPTS)
end
# Show the command being executed
echo -e "\033[1;36m[gamescope-run]\033[0m Running: \033[1;34m${lib.getExe pkgs.gamescope_git}\033[0m $final_args \033[1;32m--\033[0m $argv"
# Execute gamescope with the final arguments and the command
exec ${lib.getExe pkgs.gamescope_git} $final_args -- $argv
'';
## Effectively forces gamescope-run to be the default way to use Steam
## Why? Because , .desktops created by Steam would not run under gamescope-run otherwise
## !!! do not use 'pkgs.steam', it will not be configured correctly
steam-wrapper = pkgs.writeScriptBin "steam" ''
#!${lib.getExe pkgs.fish}
# This script wraps the original steam command to launch it
# with gamescope-run in a big picture mode.
# All arguments passed to this script are forwarded.
exec ${lib.getExe gamescope-run} -x "-e" ${lib.getExe pkgs.steam} -tenfoot $argv
exec ${lib.getExe gamescope-run} -x "-e" ${lib.getExe osConfig.programs.steam.package} -tenfoot $argv
'';
## Ensures that all Lutris game launches go through Gamescope

View file

@ -74,19 +74,21 @@
inherit (pkgs)
gamemode
mangohud
gperftools
keyutils
libkrb5
libpng
libpulseaudio
libvorbis
mangohud
;
});
};
extraCompatPackages = [ pkgs.unstable.proton-ge-bin ];
# Conflicting with gamescope_git
# gamescopeSession.enable = true;
extraCompatPackages = with pkgs; [
proton-ge-bin
proton-ge-custom
proton-cachyos
];
};
gamemode = {

View file

@ -0,0 +1,47 @@
{
callPackage,
stdenv,
lib,
fetchurl,
}:
let
protonGeTitle = "Proton-CachyOS";
protonGeVersions = lib.importJSON ./versions.json;
in
stdenv.mkDerivation {
name = "proton-cachyos";
version = "${protonGeVersions.base}.${protonGeVersions.release}";
src =
let
tagName = "cachyos-${protonGeVersions.base}-${protonGeVersions.release}-slr";
fileName = "proton-cachyos-${protonGeVersions.base}-${protonGeVersions.release}-slr-x86_64.tar.xz";
in
fetchurl {
url = "https://github.com/CachyOS/proton-cachyos/releases/download/${tagName}/${fileName}";
inherit (protonGeVersions) hash;
};
buildCommand =
''
mkdir -p $out/bin
tar -C $out/bin --strip=1 -x -f $src
''
# Replace the internal name and display name
+ lib.strings.optionalString (protonGeTitle != null) ''
sed -i -r 's|"proton-cachyos-[^"]*"|"${protonGeTitle}"|g' $out/bin/compatibilitytool.vdf
sed -i -r 's|"display_name"[[:space:]]*"[^"]*"|"display_name" "${protonGeTitle}"|' $out/bin/compatibilitytool.vdf
'';
passthru.updateScript = callPackage ./update.nix { };
meta = with lib; {
description = "Compatibility tool for Steam Play based on Wine and additional components. CachyOS fork.";
homepage = "https://github.com/CachyOS/proton-cachyos";
license = licenses.bsd3;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [
tophc7
];
};
}

View file

@ -0,0 +1,55 @@
{
writeShellScript,
lib,
coreutils,
findutils,
gnugrep,
curl,
jq,
git,
nix,
nix-prefetch-git,
moreutils,
yq,
}:
let
path = lib.makeBinPath [
coreutils
curl
findutils
gnugrep
jq
moreutils
git
nix-prefetch-git
nix
yq
];
in
writeShellScript "update-proton-cachyos" ''
set -euo pipefail
PATH=${path}
srcJson=pkgs/proton-cachyos/versions.json
localBase=$(jq -r .base < $srcJson)
localRelease=$(jq -r .release < $srcJson)
latestVer=$(curl 'https://github.com/GloriousEggroll/proton-cachyos/tags.atom' | xq -r '.feed.entry[0].link."@href"' | grep -Po '(?<=/)[^/]+$')
if [ "GE-Proton''${localBase}-''${localRelease}" == "$latestVer" ]; then
exit 0
fi
latestBase=$(echo $latestVer | grep -Po '(?<=GE-Proton)[^-]+')
latestRelease=$(echo $latestVer | grep -Po '(?<=-)[^-]+$')
latestSha256=$(nix-prefetch-url --type sha256 "https://github.com/CachyOS/proton-cachyos/releases/download/''${latestVer}/''${latestVer}.tar.gz")
latestHash=$(nix-hash --to-sri --type sha256 $latestSha256)
jq \
--arg latestBase "$latestBase" --arg latestRelease "$latestRelease" --arg latestHash "$latestHash" \
'.base = $latestBase | .release = $latestRelease | .hash = $latestHash' \
"$srcJson" | sponge "$srcJson"
git add $srcJson
git commit -m "proton-cachyos: ''${localBase}.''${localRelease} -> ''${latestBase}.''${latestRelease}"
''

View file

@ -0,0 +1,5 @@
{
"base": "10.0",
"release": "20250623",
"hash": "sha256-HLWWR2h+AdGfqt3Aay9Xyz7Q06NRoi3/Mp5vJtoqLlg="
}