From 5c33791df3046a15de4969fb110129cfa2fe492c Mon Sep 17 00:00:00 2001 From: K900 Date: Wed, 16 Oct 2024 21:49:32 +0300 Subject: [PATCH] steam (and friends): migrate to by-name, small cleanups all over - rename "steam-original" or "steam" to "steam-unwrapped", as that's what it is - rename "steam-fhsenv" to "steam", as that's what you actually want - remove some no-longer-relevant hacks --- nixos/modules/hardware/steam-hardware.nix | 2 +- .../st/steam-unwrapped/package.nix} | 22 ++------- .../st/steam-unwrapped/update.py} | 2 +- .../st/steam/package.nix} | 12 ++--- .../st/steamcmd/package.nix} | 0 .../steam => by-name/st/steamcmd}/steamcmd.sh | 0 pkgs/games/steam/build-wrapped.sh | 47 ------------------- pkgs/games/steam/default.nix | 25 ---------- pkgs/top-level/aliases.nix | 7 +++ pkgs/top-level/all-packages.nix | 11 ++--- pkgs/top-level/packages-config.nix | 1 - 11 files changed, 24 insertions(+), 105 deletions(-) rename pkgs/{games/steam/steam.nix => by-name/st/steam-unwrapped/package.nix} (71%) rename pkgs/{games/steam/update-bootstrap.py => by-name/st/steam-unwrapped/update.py} (97%) rename pkgs/{games/steam/fhsenv.nix => by-name/st/steam/package.nix} (94%) rename pkgs/{games/steam/steamcmd.nix => by-name/st/steamcmd/package.nix} (100%) rename pkgs/{games/steam => by-name/st/steamcmd}/steamcmd.sh (100%) delete mode 100644 pkgs/games/steam/build-wrapped.sh delete mode 100644 pkgs/games/steam/default.nix diff --git a/nixos/modules/hardware/steam-hardware.nix b/nixos/modules/hardware/steam-hardware.nix index aed008b588e8..bd1e6ae8f708 100644 --- a/nixos/modules/hardware/steam-hardware.nix +++ b/nixos/modules/hardware/steam-hardware.nix @@ -16,7 +16,7 @@ in config = lib.mkIf cfg.enable { services.udev.packages = [ - pkgs.steamPackages.steam + pkgs.steam-unwrapped ]; # The uinput module needs to be loaded in order to trigger the udev rules diff --git a/pkgs/games/steam/steam.nix b/pkgs/by-name/st/steam-unwrapped/package.nix similarity index 71% rename from pkgs/games/steam/steam.nix rename to pkgs/by-name/st/steam-unwrapped/package.nix index bbdb946a6b06..aff83ec2ef55 100644 --- a/pkgs/games/steam/steam.nix +++ b/pkgs/by-name/st/steam-unwrapped/package.nix @@ -1,7 +1,7 @@ -{ lib, stdenv, fetchurl, runtimeShell, traceDeps ? false, bash }: +{ lib, stdenv, fetchurl, bash }: stdenv.mkDerivation (finalAttrs: { - pname = "steam-original"; + pname = "steam-unwrapped"; version = "1.0.0.81"; src = fetchurl { @@ -12,20 +12,8 @@ stdenv.mkDerivation (finalAttrs: { makeFlags = [ "DESTDIR=$(out)" "PREFIX=" ]; - postInstall = - let - traceLog = "/tmp/steam-trace-dependencies.log"; - in '' + postInstall = '' rm $out/bin/steamdeps - ${lib.optionalString traceDeps '' - cat > $out/bin/steamdeps <> ${traceLog} - cat \$1 >> ${traceLog} - echo >> ${traceLog} - EOF - chmod +x $out/bin/steamdeps - ''} # install udev rules mkdir -p $out/etc/udev/rules.d/ @@ -38,7 +26,7 @@ stdenv.mkDerivation (finalAttrs: { sed -e 's,/usr/bin/steam,steam,g' steam.desktop > $out/share/applications/steam.desktop ''; - passthru.updateScript = ./update-bootstrap.py; + passthru.updateScript = ./update.py; meta = with lib; { description = "Digital distribution platform"; @@ -49,7 +37,7 @@ stdenv.mkDerivation (finalAttrs: { ''; homepage = "https://store.steampowered.com/"; license = licenses.unfreeRedistributable; - maintainers = with maintainers; [ jagajaga ]; + maintainers = lib.teams.steam.members ++ [ lib.maintainers.jagajaga ]; mainProgram = "steam"; }; }) diff --git a/pkgs/games/steam/update-bootstrap.py b/pkgs/by-name/st/steam-unwrapped/update.py similarity index 97% rename from pkgs/games/steam/update-bootstrap.py rename to pkgs/by-name/st/steam-unwrapped/update.py index 7720a08f4fce..e49014fee899 100755 --- a/pkgs/games/steam/update-bootstrap.py +++ b/pkgs/by-name/st/steam-unwrapped/update.py @@ -27,5 +27,5 @@ if len(found_versions) == 0: sys.exit(1) found_versions.sort() -subprocess.run(["nix-update", "--version", found_versions[-1], "steamPackages.steam"]) +subprocess.run(["nix-update", "--version", found_versions[-1], "steam-unwrapped"]) found_versions[0] diff --git a/pkgs/games/steam/fhsenv.nix b/pkgs/by-name/st/steam/package.nix similarity index 94% rename from pkgs/games/steam/fhsenv.nix rename to pkgs/by-name/st/steam/package.nix index 1eb6dffd3a39..bc727e0ebfc5 100644 --- a/pkgs/games/steam/fhsenv.nix +++ b/pkgs/by-name/st/steam/package.nix @@ -1,6 +1,6 @@ { lib, - steam, + steam-unwrapped, buildFHSEnv, writeShellScript, extraPkgs ? pkgs: [ ], # extra packages to add to targetPkgs @@ -21,7 +21,7 @@ let # https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/blob/main/docs/distro-assumptions.md#command-line-tools targetPkgs = pkgs: with pkgs; [ - steam + steam-unwrapped bash coreutils @@ -63,8 +63,8 @@ let libcap # not documented, required by srt-bwrap ] ++ extraLibraries pkgs; - extraInstallCommands = lib.optionalString (steam != null) '' - ln -s ${steam}/share $out/share + extraInstallCommands = lib.optionalString (steam-unwrapped != null) '' + ln -s ${steam-unwrapped}/share $out/share ''; profile = '' @@ -124,7 +124,7 @@ in steamEnv { exec "$@" ''; - meta = (steam.meta or {}) // { + meta = (steam-unwrapped.meta or {}) // { description = "Run commands in the same FHS environment that is used for Steam"; mainProgram = "steam-run"; name = "steam-run"; @@ -135,7 +135,7 @@ in steamEnv { }; }; - meta = (steam.meta or {}) // { + meta = (steam-unwrapped.meta or {}) // { description = "Steam dependencies (dummy package, do not use)"; }; } diff --git a/pkgs/games/steam/steamcmd.nix b/pkgs/by-name/st/steamcmd/package.nix similarity index 100% rename from pkgs/games/steam/steamcmd.nix rename to pkgs/by-name/st/steamcmd/package.nix diff --git a/pkgs/games/steam/steamcmd.sh b/pkgs/by-name/st/steamcmd/steamcmd.sh similarity index 100% rename from pkgs/games/steam/steamcmd.sh rename to pkgs/by-name/st/steamcmd/steamcmd.sh diff --git a/pkgs/games/steam/build-wrapped.sh b/pkgs/games/steam/build-wrapped.sh deleted file mode 100644 index ddf974671a03..000000000000 --- a/pkgs/games/steam/build-wrapped.sh +++ /dev/null @@ -1,47 +0,0 @@ -source $stdenv/setup - -outp=$out/lib/steam-runtime - -buildDir() { - paths="$1" - pkgs="$2" - - for pkg in $pkgs; do - echo "adding package $pkg" - for path in $paths; do - if [ -d $pkg/$path ]; then - cd $pkg/$path - for file in *; do - found="" - for i in $paths; do - if [ -e "$outp/$i/$file" ]; then - found=1 - break - fi - done - if [ -z "$found" ]; then - mkdir -p $outp/$path - ln -s "$pkg/$path/$file" $outp/$path - sovers=$(echo $file | perl -ne 'print if s/.*?\.so\.(.*)/\1/') - if [ ! -z "$sovers" ]; then - fname=''${file%.''${sovers}} - for ver in ''${sovers//./ }; do - found="" - for i in $paths; do - if [ -e "$outp/$i/$fname" ]; then - found=1 - break - fi - done - [ -n "$found" ] || ln -s "$pkg/$path/$file" "$outp/$path/$fname" - fname="$fname.$ver" - done - fi - fi - done - fi - done - done -} - -eval "$installPhase" diff --git a/pkgs/games/steam/default.nix b/pkgs/games/steam/default.nix deleted file mode 100644 index ee2b72be5400..000000000000 --- a/pkgs/games/steam/default.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ makeScopeWithSplicing', generateSplicesForMkScope -, stdenv -}: - -let - steamPackagesFun = self: let - inherit (self) callPackage; - in rec { - steamArch = if stdenv.hostPlatform.system == "x86_64-linux" then "amd64" - else if stdenv.hostPlatform.system == "i686-linux" then "i386" - else throw "Unsupported platform: ${stdenv.hostPlatform.system}"; - - steam = callPackage ./steam.nix { }; - steam-fhsenv = callPackage ./fhsenv.nix {}; - - # This has to exist so Hydra tries to build all of Steam's dependencies. - # FIXME: Maybe we should expose it as something more generic? - steam-fhsenv-without-steam = steam-fhsenv.override { steam = null; }; - - steamcmd = callPackage ./steamcmd.nix { }; - }; -in makeScopeWithSplicing' { - otherSplices = generateSplicesForMkScope "steamPackages"; - f = steamPackagesFun; -} diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index beb2e4615302..16bc4f059475 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1550,6 +1550,13 @@ mapAliases { ssm-agent = amazon-ssm-agent; # Added 2023-10-17 starboard-octant-plugin = throw "starboard-octant-plugin has been dropped due to needing octant which is archived"; # Added 2023-09-29 starspace = throw "starspace has been removed from nixpkgs, as it was broken"; # Added 2024-07-15 + steamPackages = { + steamArch = throw "`steamPackages.steamArch` has been removed as it's no longer applicable"; + steam = lib.warn "`steamPackages.steam` has been moved to top level as `steam-unwrapped`" steam-unwrapped; + steam-fhsenv = lib.warn "`steamPackages.steam-fhsenv` has been moved to top level as `steam`" steam; + steam-fhsenv-without-steam = lib.warn "`steamPackages.steam-fhsenv-without-steam` has been moved to top level as `steam-fhsenv-without-steam`" steam-fhsenv-without-steam; + steamcmd = lib.warn "`steamPackages.steamcmd` has been moved to top level as `steamcmd`" steamcmd; + }; steam-small = steam; # Added 2024-09-12 steam-run-native = steam-run; # added 2022-02-21 StormLib = stormlib; # Added 2024-01-21 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 89501790ab91..da091b43dd45 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -35203,18 +35203,15 @@ with pkgs; stockfish = callPackage ../games/stockfish { }; - steamPackages = recurseIntoAttrs (callPackage ../games/steam { }); - - steam = steamPackages.steam-fhsenv; - steam-run = steam.run; - steam-run-free = steamPackages.steam-fhsenv-without-steam.run; + # This exists so Hydra tries to build all of Steam's dependencies. + steam-fhsenv-without-steam = steam.override { steam-unwrapped = null; }; + + steam-run-free = steam-fhsenv-without-steam.run; steam-tui = callPackage ../games/steam-tui { }; - steamcmd = steamPackages.steamcmd; - steam-acf = callPackage ../tools/games/steam-acf { }; steamback = python311.pkgs.callPackage ../tools/games/steamback { }; diff --git a/pkgs/top-level/packages-config.nix b/pkgs/top-level/packages-config.nix index bd88c98df960..51c2b44fc584 100644 --- a/pkgs/top-level/packages-config.nix +++ b/pkgs/top-level/packages-config.nix @@ -21,7 +21,6 @@ rPackages roundcubePlugins sourceHanPackages - steamPackages ut2004Packages zabbix50 zabbix60