1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-17 19:21:04 +00:00

Steam: update bootstrap (#343600)

This commit is contained in:
K900 2024-09-22 07:22:25 +03:00 committed by GitHub
commit 6c8c52c5e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 42 additions and 10 deletions

View file

@ -1,22 +1,21 @@
{ lib, stdenv, fetchurl, runtimeShell, traceDeps ? false, bash }:
let
traceLog = "/tmp/steam-trace-dependencies.log";
version = "1.0.0.74";
in stdenv.mkDerivation {
stdenv.mkDerivation (finalAttrs: {
pname = "steam-original";
inherit version;
version = "1.0.0.81";
src = fetchurl {
# use archive url so the tarball doesn't 404 on a new release
url = "https://repo.steampowered.com/steam/archive/stable/steam_${version}.tar.gz";
sha256 = "sha256-sO07g3j1Qejato2LWJ2FrW3AzfMCcBz46HEw7aKxojQ=";
url = "https://repo.steampowered.com/steam/archive/stable/steam_${finalAttrs.version}.tar.gz";
hash = "sha256-Gia5182s4J4E3Ia1EeC5kjJX9mSltsr+b+1eRtEXtPk=";
};
makeFlags = [ "DESTDIR=$(out)" "PREFIX=" ];
postInstall = ''
postInstall =
let
traceLog = "/tmp/steam-trace-dependencies.log";
in ''
rm $out/bin/steamdeps
${lib.optionalString traceDeps ''
cat > $out/bin/steamdeps <<EOF
@ -39,6 +38,8 @@ in stdenv.mkDerivation {
sed -e 's,/usr/bin/steam,steam,g' steam.desktop > $out/share/applications/steam.desktop
'';
passthru.updateScript = ./update-bootstrap.py;
meta = with lib; {
description = "Digital distribution platform";
longDescription = ''
@ -51,4 +52,4 @@ in stdenv.mkDerivation {
maintainers = with maintainers; [ jagajaga ];
mainProgram = "steam";
};
}
})

View file

@ -0,0 +1,31 @@
#!/usr/bin/env nix-shell
#!nix-shell --pure --keep NIX_PATH -i python3 -p git nix-update "python3.withPackages (ps: [ ps.beautifulsoup4 ps.requests ])"
import sys
import re
import requests
import subprocess
from bs4 import BeautifulSoup
VERSION_PATTERN = re.compile(r'^steam_(?P<ver>(\d+\.)+)tar.gz$')
found_versions = []
response = requests.get("https://repo.steampowered.com/steam/archive/stable/")
soup = BeautifulSoup (response.text, "html.parser")
for a in soup.find_all("a"):
href = a["href"]
if not href.endswith(".tar.gz"):
continue
match = VERSION_PATTERN.match(href)
if match is not None:
version = match.groupdict()["ver"][0:-1]
found_versions.append(version)
if len(found_versions) == 0:
print("Failed to find available versions!", file=sys.stderr)
sys.exit(1)
found_versions.sort()
subprocess.run(["nix-update", "--version", found_versions[-1], "steamPackages.steam"])
found_versions[0]