Merge pull request #296009 from Atemu/steamcompattools

proton-ge-bin: init at 9-1, nixos/steam: use steamcompattool output for extraCompatPackages
This commit is contained in:
Atemu 2024-03-16 20:57:05 +00:00 committed by GitHub
commit 44a3dd2ef4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 68 additions and 3 deletions

View file

@ -44,7 +44,7 @@ in {
'';
apply = steam: steam.override (prev: {
extraEnv = (lib.optionalAttrs (cfg.extraCompatPackages != [ ]) {
STEAM_EXTRA_COMPAT_TOOLS_PATHS = makeBinPath cfg.extraCompatPackages;
STEAM_EXTRA_COMPAT_TOOLS_PATHS = makeSearchPathOutput "steamcompattool" "" cfg.extraCompatPackages;
}) // (prev.extraEnv or {});
extraLibraries = pkgs: let
prevLibs = if prev ? extraLibraries then prev.extraLibraries pkgs else [ ];
@ -74,10 +74,17 @@ 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
<https://github.com/ValveSoftware/steam-for-linux/issues/6310">.
https://github.com/ValveSoftware/steam-for-linux/issues/6310.
These packages must be Steam compatibility tools that have a `steamcompattool` output.
'';
};

View file

@ -0,0 +1,57 @@
{ lib
, stdenvNoCC
, fetchzip
, writeScript
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "proton-ge-bin";
version = "GE-Proton9-1";
src = fetchzip {
url = "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/${finalAttrs.version}/${finalAttrs.version}.tar.gz";
hash = "sha256-odpzRlzW7MJGRcorRNo784Rh97ssViO70/1azHRggf0=";
};
outputs = [ "out" "steamcompattool" ];
buildCommand = ''
runHook preBuild
# 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
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: <https://github.com/NixOS/nixpkgs/pull/294532#issuecomment-1987359650>
*/
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.
(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 ];
platforms = [ "x86_64-linux" ];
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
};
})

View file

@ -309,6 +309,7 @@ in buildFHSEnv rec {
description = "Steam dependencies (dummy package, do not use)";
};
passthru.steamargs = args;
passthru.run = buildFHSEnv {
name = "steam-run";