From 1b42f2ffbf5c12044b9792a77f5828f6877ccae1 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Thu, 14 Mar 2024 05:40:09 +0300 Subject: [PATCH 1/6] proton-ge-bin: init at init at 9-1 Co-authored-by: Shawn8901 --- pkgs/by-name/pr/proton-ge-bin/package.nix | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 pkgs/by-name/pr/proton-ge-bin/package.nix diff --git a/pkgs/by-name/pr/proton-ge-bin/package.nix b/pkgs/by-name/pr/proton-ge-bin/package.nix new file mode 100644 index 000000000000..1002a549cbcd --- /dev/null +++ b/pkgs/by-name/pr/proton-ge-bin/package.nix @@ -0,0 +1,50 @@ +{ lib +, stdenvNoCC +, fetchurl +, writeScript +}: +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "proton-ge-bin"; + version = "GE-Proton9-1"; + + src = fetchurl { + url = "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/${finalAttrs.version}/${finalAttrs.version}.tar.gz"; + hash = "sha256-wCIffeayOy3kEwmIKB7e+NrliuSpKXoVYC334fxVB3U="; + }; + + buildCommand = '' + runHook preBuild + mkdir -p $out/{bin,opt} + tar -C $out/opt --strip=1 -x -f $src + ln -s $out/opt/toolmanifest.vdf $out/bin/toolmanifest.vdf + install -Dm644 $out/opt/compatibilitytool.vdf $out/bin/compatibilitytool.vdf + substituteInPlace $out/bin/compatibilitytool.vdf \ + --replace-fail '"install_path" "."' '"install_path" "${placeholder "out"}/opt"' + runHook postBuild + ''; + + /* + We use the created releases, and not the tags, for the update script as nix-update loads releases.atom + that contains both. Sometimes upstream pushes the tags but the Github releases don't get created due to + CI errors. Last time this happened was on 8-33, where a tag was created but no releases were created. + As of 2024-03-13, there have been no announcements indicating that the CI has been fixed, and thus + we avoid nix-update-script and use our own update script instead. + See: + */ + passthru.updateScript = writeScript "update-proton-ge" '' + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p curl jq common-updater-scripts + repo="https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases" + version="$(curl -sL "$repo" | jq 'map(select(.prerelease == false)) | .[0].tag_name' --raw-output)" + update-source-version proton-ge-bin "$version" + ''; + + meta = { + description = "Compatibility tool for Steam Play based on Wine and additional components"; + homepage = "https://github.com/GloriousEggroll/proton-ge-custom"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ NotAShelf shawn8901 ]; + platforms = [ "x86_64-linux" ]; + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; + }; +}) From 2b619c23146b7b791ed25a174add5cc8d99c8654 Mon Sep 17 00:00:00 2001 From: Atemu Date: Thu, 14 Mar 2024 23:54:02 +0100 Subject: [PATCH 2/6] nixos/steam: use steamcompattool output for extraCompatPackages This sets a standard for Steam compat tools in NixOS where they must have the compat tool in a special steamcompattool output. proton-ge-bin was adjusted to conform with it. --- nixos/modules/programs/steam.nix | 8 +++++--- pkgs/by-name/pr/proton-ge-bin/package.nix | 12 ++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/nixos/modules/programs/steam.nix b/nixos/modules/programs/steam.nix index 31803f061dce..8fc0f35c0dce 100644 --- a/nixos/modules/programs/steam.nix +++ b/nixos/modules/programs/steam.nix @@ -44,8 +44,8 @@ in { ''; apply = steam: steam.override (prev: { extraEnv = (lib.optionalAttrs (cfg.extraCompatPackages != [ ]) { - STEAM_EXTRA_COMPAT_TOOLS_PATHS = makeBinPath cfg.extraCompatPackages; - }) // (prev.extraEnv or {}); + STEAM_EXTRA_COMPAT_TOOLS_PATHS = makeSearchPathOutput "steamcompattool" "" cfg.extraCompatPackages; + }) // (prev.extraEnv or {}); extraLibraries = pkgs: let prevLibs = if prev ? extraLibraries then prev.extraLibraries pkgs else [ ]; additionalLibs = with config.hardware.opengl; @@ -77,7 +77,9 @@ in { description = lib.mdDoc '' Extra packages to be used as compatibility tools for Steam on Linux. Packages will be included in the `STEAM_EXTRA_COMPAT_TOOLS_PATHS` environmental variable. For more information see - . + https://github.com/ValveSoftware/steam-for-linux/issues/6310. + + These packages must be Steam compatibility tools that have a `steamcompattool` output. ''; }; diff --git a/pkgs/by-name/pr/proton-ge-bin/package.nix b/pkgs/by-name/pr/proton-ge-bin/package.nix index 1002a549cbcd..c64723a6b5a4 100644 --- a/pkgs/by-name/pr/proton-ge-bin/package.nix +++ b/pkgs/by-name/pr/proton-ge-bin/package.nix @@ -12,14 +12,14 @@ stdenvNoCC.mkDerivation (finalAttrs: { hash = "sha256-wCIffeayOy3kEwmIKB7e+NrliuSpKXoVYC334fxVB3U="; }; + outputs = [ "out" "steamcompattool" ]; + buildCommand = '' runHook preBuild - mkdir -p $out/{bin,opt} - tar -C $out/opt --strip=1 -x -f $src - ln -s $out/opt/toolmanifest.vdf $out/bin/toolmanifest.vdf - install -Dm644 $out/opt/compatibilitytool.vdf $out/bin/compatibilitytool.vdf - substituteInPlace $out/bin/compatibilitytool.vdf \ - --replace-fail '"install_path" "."' '"install_path" "${placeholder "out"}/opt"' + mkdir -p $out $steamcompattool + + tar -C $steamcompattool --strip=1 -x -f $src + runHook postBuild ''; From c67a030aa25b97e0067fd751237b745254f4d1b0 Mon Sep 17 00:00:00 2001 From: Atemu Date: Thu, 14 Mar 2024 23:58:54 +0100 Subject: [PATCH 3/6] steam: passthru steam's args This makes it possible to introspect steam-specific arguments such as extraEnv. --- pkgs/games/steam/fhsenv.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/games/steam/fhsenv.nix b/pkgs/games/steam/fhsenv.nix index 9c68f241a7fe..4a1cdb93fc06 100644 --- a/pkgs/games/steam/fhsenv.nix +++ b/pkgs/games/steam/fhsenv.nix @@ -309,6 +309,7 @@ in buildFHSEnv rec { description = "Steam dependencies (dummy package, do not use)"; }; + passthru.steamargs = args; passthru.run = buildFHSEnv { name = "steam-run"; From ac37f3f75475afe6641aa35ce50e7fca9ece0134 Mon Sep 17 00:00:00 2001 From: Atemu Date: Fri, 15 Mar 2024 00:05:55 +0100 Subject: [PATCH 4/6] proton-ge-bin: simplify Simply use fetchzip and create a symlink to the src rather than unpacking manually. --- pkgs/by-name/pr/proton-ge-bin/package.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/pr/proton-ge-bin/package.nix b/pkgs/by-name/pr/proton-ge-bin/package.nix index c64723a6b5a4..92c841349a4a 100644 --- a/pkgs/by-name/pr/proton-ge-bin/package.nix +++ b/pkgs/by-name/pr/proton-ge-bin/package.nix @@ -1,24 +1,26 @@ { lib , stdenvNoCC -, fetchurl +, fetchzip , writeScript }: stdenvNoCC.mkDerivation (finalAttrs: { pname = "proton-ge-bin"; version = "GE-Proton9-1"; - src = fetchurl { + src = fetchzip { url = "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/${finalAttrs.version}/${finalAttrs.version}.tar.gz"; - hash = "sha256-wCIffeayOy3kEwmIKB7e+NrliuSpKXoVYC334fxVB3U="; + hash = "sha256-odpzRlzW7MJGRcorRNo784Rh97ssViO70/1azHRggf0="; }; outputs = [ "out" "steamcompattool" ]; buildCommand = '' runHook preBuild - mkdir -p $out $steamcompattool - tar -C $steamcompattool --strip=1 -x -f $src + # Intentionally empty + mkdir -p $out + + ln -s $src $steamcompattool runHook postBuild ''; From 74c55dbb254680170610c931fb839966d7c0bad2 Mon Sep 17 00:00:00 2001 From: Atemu Date: Fri, 15 Mar 2024 00:22:28 +0100 Subject: [PATCH 5/6] proton-ge-bin: make $out provide an error when added to an env This package should never be added to systemPackages or other global environments as it will not provide any function there. Making its $out a file will prevent buildEnv from including it; providing an error like this: error: The store path /nix/store/wxl3m27dmjjsfqvzzxw7ibr0gr54wwkp-proton-ge-bin-GE-Proton9-1 is a file and can't be merged into an environment using pkgs.buildEnv! at /nix/store/ndhb3bsaf3zc6gx22vjl0w11sxvapf7b-builder.pl line 122. Some breadcrumbs are left inside the file. --- pkgs/by-name/pr/proton-ge-bin/package.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/pr/proton-ge-bin/package.nix b/pkgs/by-name/pr/proton-ge-bin/package.nix index 92c841349a4a..68e147ca4f9c 100644 --- a/pkgs/by-name/pr/proton-ge-bin/package.nix +++ b/pkgs/by-name/pr/proton-ge-bin/package.nix @@ -17,8 +17,9 @@ stdenvNoCC.mkDerivation (finalAttrs: { buildCommand = '' runHook preBuild - # Intentionally empty - mkdir -p $out + # Make it impossible to add to an environment. You should use the appropriate NixOS option. + # Also leave some breadcrumbs in the file. + echo "${finalAttrs.pname} should not be installed into environments. Please use programs.steam.extraCompatPackages instead." > $out ln -s $src $steamcompattool @@ -42,7 +43,11 @@ stdenvNoCC.mkDerivation (finalAttrs: { ''; meta = { - description = "Compatibility tool for Steam Play based on Wine and additional components"; + description = '' + Compatibility tool for Steam Play based on Wine and additional components. + + (This is intended for use in the `programs.steam.extraCompatPackages` option only.) + ''; homepage = "https://github.com/GloriousEggroll/proton-ge-custom"; license = lib.licenses.bsd3; maintainers = with lib.maintainers; [ NotAShelf shawn8901 ]; From bdc55d2f8671881b81d6797928b3e7569235b1ba Mon Sep 17 00:00:00 2001 From: Atemu Date: Sat, 16 Mar 2024 12:07:52 +0100 Subject: [PATCH 6/6] nixos/steam: provide example in extraCompatPackages --- nixos/modules/programs/steam.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nixos/modules/programs/steam.nix b/nixos/modules/programs/steam.nix index 8fc0f35c0dce..c93a34f61849 100644 --- a/nixos/modules/programs/steam.nix +++ b/nixos/modules/programs/steam.nix @@ -74,6 +74,11 @@ in { extraCompatPackages = mkOption { type = types.listOf types.package; default = [ ]; + example = literalExpression '' + with pkgs; [ + proton-ge-bin + ] + ''; description = lib.mdDoc '' Extra packages to be used as compatibility tools for Steam on Linux. Packages will be included in the `STEAM_EXTRA_COMPAT_TOOLS_PATHS` environmental variable. For more information see