From e6262e0cede2220bc36e9293571372a11319ed40 Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Sun, 22 Sep 2024 10:06:25 +1200 Subject: [PATCH 1/4] steamPackages.steam: convert to use finalAttrs --- pkgs/games/steam/steam.nix | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/pkgs/games/steam/steam.nix b/pkgs/games/steam/steam.nix index 151a1ba5be46..262d682b8af8 100644 --- a/pkgs/games/steam/steam.nix +++ b/pkgs/games/steam/steam.nix @@ -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.74"; 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"; + url = "https://repo.steampowered.com/steam/archive/stable/steam_${finalAttrs.version}.tar.gz"; sha256 = "sha256-sO07g3j1Qejato2LWJ2FrW3AzfMCcBz46HEw7aKxojQ="; }; 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 < Date: Sat, 21 Sep 2024 18:42:46 +1200 Subject: [PATCH 2/4] steamPackages.steam: add update script --- pkgs/games/steam/steam.nix | 2 ++ pkgs/games/steam/update-bootstrap.py | 31 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100755 pkgs/games/steam/update-bootstrap.py diff --git a/pkgs/games/steam/steam.nix b/pkgs/games/steam/steam.nix index 262d682b8af8..b769c6d956cf 100644 --- a/pkgs/games/steam/steam.nix +++ b/pkgs/games/steam/steam.nix @@ -38,6 +38,8 @@ stdenv.mkDerivation (finalAttrs: { 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 = '' diff --git a/pkgs/games/steam/update-bootstrap.py b/pkgs/games/steam/update-bootstrap.py new file mode 100755 index 000000000000..7720a08f4fce --- /dev/null +++ b/pkgs/games/steam/update-bootstrap.py @@ -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(\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] From 2af6e069b35e2253a1a9160f719b7bffe517b581 Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Sun, 22 Sep 2024 10:22:15 +1200 Subject: [PATCH 3/4] steamPackages.steam: use hash instead of sha256 attr --- pkgs/games/steam/steam.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/games/steam/steam.nix b/pkgs/games/steam/steam.nix index b769c6d956cf..40ec210ebbbe 100644 --- a/pkgs/games/steam/steam.nix +++ b/pkgs/games/steam/steam.nix @@ -7,7 +7,7 @@ stdenv.mkDerivation (finalAttrs: { src = fetchurl { # use archive url so the tarball doesn't 404 on a new release url = "https://repo.steampowered.com/steam/archive/stable/steam_${finalAttrs.version}.tar.gz"; - sha256 = "sha256-sO07g3j1Qejato2LWJ2FrW3AzfMCcBz46HEw7aKxojQ="; + hash = "sha256-sO07g3j1Qejato2LWJ2FrW3AzfMCcBz46HEw7aKxojQ="; }; makeFlags = [ "DESTDIR=$(out)" "PREFIX=" ]; From 425fa5a71049625649feaa57ddd50aba6e21cd96 Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Sun, 22 Sep 2024 10:25:19 +1200 Subject: [PATCH 4/4] steamPackages.steam: 1.0.0.74 -> 1.0.0.81 --- pkgs/games/steam/steam.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/games/steam/steam.nix b/pkgs/games/steam/steam.nix index 40ec210ebbbe..bbdb946a6b06 100644 --- a/pkgs/games/steam/steam.nix +++ b/pkgs/games/steam/steam.nix @@ -2,12 +2,12 @@ stdenv.mkDerivation (finalAttrs: { pname = "steam-original"; - version = "1.0.0.74"; + 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_${finalAttrs.version}.tar.gz"; - hash = "sha256-sO07g3j1Qejato2LWJ2FrW3AzfMCcBz46HEw7aKxojQ="; + hash = "sha256-Gia5182s4J4E3Ia1EeC5kjJX9mSltsr+b+1eRtEXtPk="; }; makeFlags = [ "DESTDIR=$(out)" "PREFIX=" ];