From 972b1348dad98d6d88e51ebf5404a4eb5f13d888 Mon Sep 17 00:00:00 2001 From: Gavin John Date: Tue, 3 Sep 2024 15:42:13 -0700 Subject: [PATCH 01/10] fetchSteam: init builder (derived from nix-community) --- doc/build-helpers/fetchers.chapter.md | 28 +++++++++++ pkgs/build-support/fetchsteam/default.nix | 60 +++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 90 insertions(+) create mode 100644 pkgs/build-support/fetchsteam/default.nix diff --git a/doc/build-helpers/fetchers.chapter.md b/doc/build-helpers/fetchers.chapter.md index 21cadfaa21fa5..7af065e4f0dfc 100644 --- a/doc/build-helpers/fetchers.chapter.md +++ b/doc/build-helpers/fetchers.chapter.md @@ -888,3 +888,31 @@ fetchtorrent { - `config`: When using `transmission` as the `backend`, a json configuration can be supplied to transmission. Refer to the [upstream documentation](https://github.com/transmission/transmission/blob/main/docs/Editing-Configuration-Files.md) for information on how to configure. +## `fetchSteam` ${#fetchsteam} + +`fetchSteam` expects at least three arguments: `app`, `depot`, and `manifest`. Use [SteamDB](https://steamdb.info/) to find these values. `fetchSteam` only supports anonymous accounts. + +```nix +{ fetchSteam }: + +fetchSteam { + name = "steamvr-linux-depot"; + app = 250820; + depot = 250823; + manifest = 5747149350848671194; + hash = "sha256-q3jasX/prYhs+Vs7Ofru2N3WVxf/0tGlqTd5SvKRm10="; +} +``` + +### Parameters {#fetchsteam-parameters} + +- `name` (string): The name of the resulting derivation. Defaults to `"${app}-${depot}-${manifest}-depot"`. +- `app` (integer): The Steam app ID +- `depot` (integer): The Steam depot ID +- `manifest` (integer): The Steam manifest ID +- `branch` (string): Optional. The branch to download from. Cannot require a password. Defaults to none. +- `language` (string): Optional. The language for which to download the game. Defaults to DepotDownloader's default (english). +- `lowViolence` (boolean): Optional. Whether to download low-violence variations. Defaults to `false`. +- `fileList` (list of string): Optional. A list of files to download. Defaults to all files. +- `fileListRegex` (boolean): Optional. Whether `fileList` should be treated as a list of regular expressions to match the paths of the files. Defaults to `false`. +- `debug` (boolean): Optional. Prints additional debug information. Defaults to `false`. diff --git a/pkgs/build-support/fetchsteam/default.nix b/pkgs/build-support/fetchsteam/default.nix new file mode 100644 index 0000000000000..e1f47789b8cb9 --- /dev/null +++ b/pkgs/build-support/fetchsteam/default.nix @@ -0,0 +1,60 @@ +{ + lib, + runCommand, + depotdownloader, + cacert, + writeText, +}: + +{ + name ? "${toString app}-${toString depot}-${toString manifest}-depot", + app, + depot, + manifest, + branch ? null, + language ? null, + lowViolence ? false, + fileList ? [ ], + fileListRegex ? false, + debug ? false, + hash ? lib.fakeHash, +}: + +runCommand name + { + nativeBuildInputs = [ depotdownloader ]; + + env.SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; + + outputHash = hash; + outputHashMode = "recursive"; + } + '' + # Hack to prevent DepotDownloader from crashing trying to write to ~/.local/share/ + export HOME=$(mktemp -d) + + DepotDownloader \ + -app "${toString app}" \ + -depot "${toString depot}" \ + -manifest "${toString manifest}" \ + ${lib.optionalString (branch != null) "-beta ${branch}"} \ + ${lib.optionalString (language != null) "-language ${language}"} \ + ${lib.optionalString lowViolence "-lowviolence"} \ + ${ + lib.optionalString (fileList != [ ]) ( + (lib.optionalString fileListRegex "regex:") + + (writeText "steam-file-list-${name}.txt" (lib.concatStringsSep "\n" fileList)) + ) + } \ + ${lib.optionalString debug "-debug"} \ + -loginid ${ + # From DepotDownloader help: + # -loginid <#> - a unique 32-bit integer Steam LogonID in decimal, required if running multiple instances of DepotDownloader concurrently. + # We are running multiple instances of DepotDownloader concurrently, so this is required. + # Setting this to the manifest mod 2^32 will almost always result in a deterministic unique value. + # Nix doesn't have a builtin for mod, so we have to do it manually. + toString (manifest - (manifest / 4294967295) * 4294967295) + } \ + -dir $out + rm -rf $out/.DepotDownloader + '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 20e9922915cc1..70b40a6057d68 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -571,6 +571,8 @@ with pkgs; fetchs3 = callPackage ../build-support/fetchs3 { }; + fetchSteam = callPackage ../build-support/fetchsteam { }; + fetchtorrent = callPackage ../build-support/fetchtorrent { }; fetchsvn = if stdenv.buildPlatform != stdenv.hostPlatform From 3a423079db07348b233e1d6310b11933d174e372 Mon Sep 17 00:00:00 2001 From: Gavin John Date: Sat, 9 Nov 2024 22:30:27 -0800 Subject: [PATCH 02/10] fetchSteam: Downgrade depotdownloader to 2.5.0 --- .../depotdownloader_2_5_0/default.nix | 31 +++++++++++++++++++ .../fetchsteam/depotdownloader_2_5_0/deps.nix | 15 +++++++++ pkgs/top-level/all-packages.nix | 30 +++++++++++++++++- 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 pkgs/build-support/fetchsteam/depotdownloader_2_5_0/default.nix create mode 100644 pkgs/build-support/fetchsteam/depotdownloader_2_5_0/deps.nix diff --git a/pkgs/build-support/fetchsteam/depotdownloader_2_5_0/default.nix b/pkgs/build-support/fetchsteam/depotdownloader_2_5_0/default.nix new file mode 100644 index 0000000000000..5a2fee4e83eff --- /dev/null +++ b/pkgs/build-support/fetchsteam/depotdownloader_2_5_0/default.nix @@ -0,0 +1,31 @@ +{ lib +, buildDotnetModule +, fetchFromGitHub +, dotnetCorePackages +}: + +buildDotnetModule rec { + pname = "depotdownloader"; + version = "2.5.0"; + + src = fetchFromGitHub { + owner = "SteamRE"; + repo = "DepotDownloader"; + rev = "DepotDownloader_${version}"; + sha256 = "Kgi0u+H5BIAhrjk9e+8H1h0p5Edm3+2twYBPY3JQGps="; + }; + + projectFile = "DepotDownloader.sln"; + nugetDeps = ./deps.nix; + + passthru.updateScript = ./update.sh; + + meta = with lib; { + description = "Steam depot downloader utilizing the SteamKit2 library"; + changelog = "https://github.com/SteamRE/DepotDownloader/releases/tag/DepotDownloader_${version}"; + license = licenses.gpl2Only; + maintainers = [ maintainers.babbaj ]; + platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + mainProgram = "DepotDownloader"; + }; +} diff --git a/pkgs/build-support/fetchsteam/depotdownloader_2_5_0/deps.nix b/pkgs/build-support/fetchsteam/depotdownloader_2_5_0/deps.nix new file mode 100644 index 0000000000000..58e2f63ba01d4 --- /dev/null +++ b/pkgs/build-support/fetchsteam/depotdownloader_2_5_0/deps.nix @@ -0,0 +1,15 @@ +# This file was automatically generated by passthru.fetch-deps. +# Please dont edit it manually, your changes might get overwritten! + +{ fetchNuGet }: [ + (fetchNuGet { pname = "Microsoft.NETCore.Platforms"; version = "5.0.0"; sha256 = "0mwpwdflidzgzfx2dlpkvvnkgkr2ayaf0s80737h4wa35gaj11rc"; }) + (fetchNuGet { pname = "Microsoft.Win32.Registry"; version = "5.0.0"; sha256 = "102hvhq2gmlcbq8y2cb7hdr2dnmjzfp2k3asr1ycwrfacwyaak7n"; }) + (fetchNuGet { pname = "protobuf-net"; version = "3.2.16"; sha256 = "0pwlqlq2p8my2sr8b0cvdav5cm8wpwf3s4gy7s1ba701ac2zyb9y"; }) + (fetchNuGet { pname = "protobuf-net.Core"; version = "3.2.16"; sha256 = "00znhikq7valr3jaxg66cwli9hf75wkmmpf6rf8p790hf8lxq0c5"; }) + (fetchNuGet { pname = "QRCoder"; version = "1.4.3"; sha256 = "1hmlqbdyq5n9bsmns5h0dwcxpd2jvqr9a2y6dyc9kbjmc8j1dpla"; }) + (fetchNuGet { pname = "SteamKit2"; version = "2.5.0-beta.1"; sha256 = "0691285g4z12hv5kpv72l36h45086n14rw56x3dnixcvrjzg2q01"; }) + (fetchNuGet { pname = "System.Collections.Immutable"; version = "7.0.0"; sha256 = "1n9122cy6v3qhsisc9lzwa1m1j62b8pi2678nsmnlyvfpk0zdagm"; }) + (fetchNuGet { pname = "System.Runtime.CompilerServices.Unsafe"; version = "6.0.0"; sha256 = "0qm741kh4rh57wky16sq4m0v05fxmkjjr87krycf5vp9f0zbahbc"; }) + (fetchNuGet { pname = "System.Security.AccessControl"; version = "5.0.0"; sha256 = "17n3lrrl6vahkqmhlpn3w20afgz09n7i6rv0r3qypngwi7wqdr5r"; }) + (fetchNuGet { pname = "System.Security.Principal.Windows"; version = "5.0.0"; sha256 = "1mpk7xj76lxgz97a5yg93wi8lj0l8p157a5d50mmjy3gbz1904q8"; }) +] diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 70b40a6057d68..be45518e6be2a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -571,7 +571,35 @@ with pkgs; fetchs3 = callPackage ../build-support/fetchs3 { }; - fetchSteam = callPackage ../build-support/fetchsteam { }; + fetchSteam = callPackage ../build-support/fetchsteam { + # Latest depotdownloader has bug: + # + # > Logging anonymously into Steam3...Unhandled exception. System.IO.DirectoryNotFoundException: Could not find a part of the path '/sys/class/net'. + # > at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound) + # > at System.IO.Enumeration.FileSystemEnumerator`1.Init() + # > at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized) + # > at System.IO.Enumeration.FileSystemEnumerableFactory.UserDirectories(String directory, String expression, EnumerationOptions options) + # > at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options) + # > at System.IO.Directory.GetDirectories(String path, String searchPattern, EnumerationOptions enumerationOptions) + # > at SteamKit2.LinuxMachineInfoProvider.GetMacAddresses(Boolean checkForPhysicalDevice) + # > at SteamKit2.LinuxMachineInfoProvider.GetMacAddress() + # > at SteamKit2.HardwareUtils.GenerateMachineID(Object state) + # > at System.Threading.Tasks.Task`1.InnerInvoke() + # > at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + # > --- End of stack trace from previous location --- + # > at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) + # > at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) + # > --- End of stack trace from previous location --- + # > at SteamKit2.HardwareUtils.GetMachineID(IMachineInfoProvider machineInfoProvider) + # > at SteamKit2.SteamUser.LogOnAnonymous(AnonymousLogOnDetails details) + # > at SteamKit2.SteamUser.LogOnAnonymous() + # > at DepotDownloader.Steam3Session.ConnectedCallback(ConnectedCallback connected) in /build/source/DepotDownloader/Steam3Session.cs:line 478 + # > at System.Threading.Tasks.Task.<>c.b__128_1(Object state) + # > at System.Threading.ThreadPoolWorkQueue.Dispatch() + # > at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() + # > /build/.attr-0l2nkwhif96f51f4amnlf414lhl4rv9vh8iffyp431v6s28gsr90: line 14: 8 Aborted (core dumped) DepotDownloader -app "250820" -depot "250824" -manifest "5862217504045387455" -loginid 101619330 -dir $out + depotdownloader = callPackage ../build-support/fetchsteam/depotdownloader_2_5_0/default.nix { }; + }; fetchtorrent = callPackage ../build-support/fetchtorrent { }; From c7afb4efb170f3533c3d7233f5c704fc1069b88d Mon Sep 17 00:00:00 2001 From: Gavin John Date: Tue, 10 Sep 2024 13:25:32 -0700 Subject: [PATCH 03/10] Revert "readline63: drop" This reverts commit ff9ecc868d2fa5f12a21eed7739aa6f5ca2b0816. --- pkgs/development/libraries/readline/6.3.nix | 68 +++++++++++++++++++ .../libraries/readline/android.patch | 16 +++++ .../readline/readline-6.3-patches.nix | 12 ++++ pkgs/top-level/aliases.nix | 3 + pkgs/top-level/all-packages.nix | 2 + 5 files changed, 101 insertions(+) create mode 100644 pkgs/development/libraries/readline/6.3.nix create mode 100644 pkgs/development/libraries/readline/android.patch create mode 100644 pkgs/development/libraries/readline/readline-6.3-patches.nix diff --git a/pkgs/development/libraries/readline/6.3.nix b/pkgs/development/libraries/readline/6.3.nix new file mode 100644 index 0000000000000..aff16c3e4184d --- /dev/null +++ b/pkgs/development/libraries/readline/6.3.nix @@ -0,0 +1,68 @@ +{ fetchurl, lib, stdenv, ncurses }: + +stdenv.mkDerivation { + pname = "readline"; + version = "6.3p08"; + + src = fetchurl { + url = "mirror://gnu/readline/readline-6.3.tar.gz"; + sha256 = "0hzxr9jxqqx5sxsv9vmlxdnvlr9vi4ih1avjb869hbs6p5qn1fjn"; + }; + + outputs = [ "out" "dev" "man" "doc" "info" ]; + + strictDeps = true; + propagatedBuildInputs = [ ncurses ]; + + patchFlags = [ "-p0" ]; + + configureFlags = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) + # This test requires running host code + "bash_cv_wcwidth_broken=no"; + + patches = + [ ./link-against-ncurses.patch + ./no-arch_only-6.3.patch + ] ++ lib.optional stdenv.hostPlatform.useAndroidPrebuilt ./android.patch + ++ + (let + patch = nr: sha256: + fetchurl { + url = "mirror://gnu/readline/readline-6.3-patches/readline63-${nr}"; + inherit sha256; + }; + in + import ./readline-6.3-patches.nix patch); + + env = lib.optionalAttrs stdenv.cc.isClang { + NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration"; + }; + + meta = with lib; { + description = "Library for interactive line editing"; + + longDescription = '' + The GNU Readline library provides a set of functions for use by + applications that allow users to edit command lines as they are + typed in. Both Emacs and vi editing modes are available. The + Readline library includes additional functions to maintain a + list of previously-entered command lines, to recall and perhaps + reedit those lines, and perform csh-like history expansion on + previous commands. + + The history facilities are also placed into a separate library, + the History library, as part of the build process. The History + library may be used without Readline in applications which + desire its capabilities. + ''; + + homepage = "https://savannah.gnu.org/projects/readline/"; + + license = licenses.gpl3Plus; + + maintainers = [ ]; + + platforms = platforms.unix; + branch = "6.3"; + }; +} diff --git a/pkgs/development/libraries/readline/android.patch b/pkgs/development/libraries/readline/android.patch new file mode 100644 index 0000000000000..7e81774be3697 --- /dev/null +++ b/pkgs/development/libraries/readline/android.patch @@ -0,0 +1,16 @@ +diff --git histlib.h histlib.h +index c938a10..925ab72 100644 +--- histlib.h ++++ histlib.h +@@ -51,9 +51,9 @@ + #endif + + #ifndef member +-# ifndef strchr ++# if !defined (strchr) && !defined (__STDC__) + extern char *strchr (); +-# endif ++# endif /* !strchr && !__STDC__ */ + #define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0) + #endif + diff --git a/pkgs/development/libraries/readline/readline-6.3-patches.nix b/pkgs/development/libraries/readline/readline-6.3-patches.nix new file mode 100644 index 0000000000000..d0aaaf38f706e --- /dev/null +++ b/pkgs/development/libraries/readline/readline-6.3-patches.nix @@ -0,0 +1,12 @@ +# Automatically generated by `update-patch-set.sh'; do not edit. + +patch: [ +(patch "001" "0vqlj22mkbn3x42qx2iqir7capx462dhagbzdw6hwxgfxavbny8s") +(patch "002" "19g0l6vlfcqzwfwjj1slkmxzndjp4543hwrf26g8z216lp3h9qrr") +(patch "003" "0bx53k876w8vwf4h2s6brr1i46ym87gi71bh8zl89n0gn3cbshgc") +(patch "004" "1k2m8dg1awmjhmivdbx1c25866gfbpg0fy4845n8cw15zc3bjis5") +(patch "005" "0jr7c28bzn882as5i54l53bhi723s1nkvzmwlh3rj6ld4bwqhxw7") +(patch "006" "0mp5zgx50792gigkmjap3d0zpdv5qanii8djab7j6z69qsrpl8sw") +(patch "007" "1sjv9w0mglh395i6hlq3ck7wdxvi2wyddlyb2j0jwg7cmnibayad") +(patch "008" "11rpqhsxd132gc8455v51ma3a5zshznb0mh2p0zc5skcab7r7h1v") +] diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index cd0b0dffff68f..7544dcb07885a 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1045,6 +1045,9 @@ mapAliases { railway-travel = diebahn; # Added 2024-04-01 rambox-pro = rambox; # Added 2022-12-12 rapidjson-unstable = lib.warn "'rapidjson-unstable' has been renamed to 'rapidjson'" rapidjson; # Added 2024-07-28 + rarian = throw "rarian has been removed as unused"; # Added 2023-07-05 + rccl = throw "'rccl' has been replaced with 'rocmPackages.rccl'"; # Added 2023-10-08 + rdc = throw "'rdc' has been replaced with 'rocmPackages.rdc'"; # Added 2023-10-08 redocly-cli = redocly; # Added 2024-04-14 redpanda = redpanda-client; # Added 2023-10-14 redpanda-server = throw "'redpanda-server' has been removed because it was broken for a long time"; # Added 2024-06-10 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index be45518e6be2a..f17633646be90 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10937,6 +10937,8 @@ with pkgs; readline = readline82; + readline63 = callPackage ../development/libraries/readline/6.3.nix { }; + readline70 = callPackage ../development/libraries/readline/7.0.nix { }; readline82 = callPackage ../development/libraries/readline/8.2.nix { }; From 1ff27dc2bc7acf8afae1e2d25c905aeb26d398c5 Mon Sep 17 00:00:00 2001 From: Gavin John Date: Tue, 10 Sep 2024 13:34:39 -0700 Subject: [PATCH 04/10] readline63: nixfmt --- pkgs/development/libraries/readline/6.3.nix | 48 ++++++++++++------- .../readline/readline-6.3-patches.nix | 16 +++---- 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/pkgs/development/libraries/readline/6.3.nix b/pkgs/development/libraries/readline/6.3.nix index aff16c3e4184d..80dd1eaffc133 100644 --- a/pkgs/development/libraries/readline/6.3.nix +++ b/pkgs/development/libraries/readline/6.3.nix @@ -1,4 +1,9 @@ -{ fetchurl, lib, stdenv, ncurses }: +{ + fetchurl, + lib, + stdenv, + ncurses, +}: stdenv.mkDerivation { pname = "readline"; @@ -9,30 +14,41 @@ stdenv.mkDerivation { sha256 = "0hzxr9jxqqx5sxsv9vmlxdnvlr9vi4ih1avjb869hbs6p5qn1fjn"; }; - outputs = [ "out" "dev" "man" "doc" "info" ]; + outputs = [ + "out" + "dev" + "man" + "doc" + "info" + ]; strictDeps = true; propagatedBuildInputs = [ ncurses ]; patchFlags = [ "-p0" ]; - configureFlags = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) - # This test requires running host code - "bash_cv_wcwidth_broken=no"; + configureFlags = + lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) + # This test requires running host code + "bash_cv_wcwidth_broken=no"; patches = - [ ./link-against-ncurses.patch + [ + ./link-against-ncurses.patch ./no-arch_only-6.3.patch - ] ++ lib.optional stdenv.hostPlatform.useAndroidPrebuilt ./android.patch - ++ - (let - patch = nr: sha256: - fetchurl { - url = "mirror://gnu/readline/readline-6.3-patches/readline63-${nr}"; - inherit sha256; - }; - in - import ./readline-6.3-patches.nix patch); + ] + ++ lib.optional stdenv.hostPlatform.useAndroidPrebuilt ./android.patch + ++ ( + let + patch = + nr: sha256: + fetchurl { + url = "mirror://gnu/readline/readline-6.3-patches/readline63-${nr}"; + inherit sha256; + }; + in + import ./readline-6.3-patches.nix patch + ); env = lib.optionalAttrs stdenv.cc.isClang { NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration"; diff --git a/pkgs/development/libraries/readline/readline-6.3-patches.nix b/pkgs/development/libraries/readline/readline-6.3-patches.nix index d0aaaf38f706e..8593efe40ee01 100644 --- a/pkgs/development/libraries/readline/readline-6.3-patches.nix +++ b/pkgs/development/libraries/readline/readline-6.3-patches.nix @@ -1,12 +1,12 @@ # Automatically generated by `update-patch-set.sh'; do not edit. patch: [ -(patch "001" "0vqlj22mkbn3x42qx2iqir7capx462dhagbzdw6hwxgfxavbny8s") -(patch "002" "19g0l6vlfcqzwfwjj1slkmxzndjp4543hwrf26g8z216lp3h9qrr") -(patch "003" "0bx53k876w8vwf4h2s6brr1i46ym87gi71bh8zl89n0gn3cbshgc") -(patch "004" "1k2m8dg1awmjhmivdbx1c25866gfbpg0fy4845n8cw15zc3bjis5") -(patch "005" "0jr7c28bzn882as5i54l53bhi723s1nkvzmwlh3rj6ld4bwqhxw7") -(patch "006" "0mp5zgx50792gigkmjap3d0zpdv5qanii8djab7j6z69qsrpl8sw") -(patch "007" "1sjv9w0mglh395i6hlq3ck7wdxvi2wyddlyb2j0jwg7cmnibayad") -(patch "008" "11rpqhsxd132gc8455v51ma3a5zshznb0mh2p0zc5skcab7r7h1v") + (patch "001" "0vqlj22mkbn3x42qx2iqir7capx462dhagbzdw6hwxgfxavbny8s") + (patch "002" "19g0l6vlfcqzwfwjj1slkmxzndjp4543hwrf26g8z216lp3h9qrr") + (patch "003" "0bx53k876w8vwf4h2s6brr1i46ym87gi71bh8zl89n0gn3cbshgc") + (patch "004" "1k2m8dg1awmjhmivdbx1c25866gfbpg0fy4845n8cw15zc3bjis5") + (patch "005" "0jr7c28bzn882as5i54l53bhi723s1nkvzmwlh3rj6ld4bwqhxw7") + (patch "006" "0mp5zgx50792gigkmjap3d0zpdv5qanii8djab7j6z69qsrpl8sw") + (patch "007" "1sjv9w0mglh395i6hlq3ck7wdxvi2wyddlyb2j0jwg7cmnibayad") + (patch "008" "11rpqhsxd132gc8455v51ma3a5zshznb0mh2p0zc5skcab7r7h1v") ] From 0c8d623c530b0fa2c935a6336bb59eabbde7e591 Mon Sep 17 00:00:00 2001 From: Gavin John Date: Tue, 10 Sep 2024 14:56:36 -0700 Subject: [PATCH 05/10] readline63: use canExecute to determine whether to run test Co-authored-by: seth --- pkgs/development/libraries/readline/6.3.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/readline/6.3.nix b/pkgs/development/libraries/readline/6.3.nix index 80dd1eaffc133..d60338c0191b0 100644 --- a/pkgs/development/libraries/readline/6.3.nix +++ b/pkgs/development/libraries/readline/6.3.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation { patchFlags = [ "-p0" ]; configureFlags = - lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) + lib.optional (stdenv.buildPlatform.canExecute stdenv.hostPlatform) # This test requires running host code "bash_cv_wcwidth_broken=no"; From dc38494af0076228251c31c9693eed073b54ce11 Mon Sep 17 00:00:00 2001 From: Gavin John Date: Mon, 16 Sep 2024 12:53:01 -0700 Subject: [PATCH 06/10] python312Packages.gevent-eventemitter: init at 2.1 --- .../gevent-eventemitter/default.nix | 36 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 ++ 2 files changed, 38 insertions(+) create mode 100644 pkgs/development/python-modules/gevent-eventemitter/default.nix diff --git a/pkgs/development/python-modules/gevent-eventemitter/default.nix b/pkgs/development/python-modules/gevent-eventemitter/default.nix new file mode 100644 index 0000000000000..fbef8a2a4d326 --- /dev/null +++ b/pkgs/development/python-modules/gevent-eventemitter/default.nix @@ -0,0 +1,36 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + coverage, + gevent, + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "gevent-eventemitter"; + version = "2.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "rossengeorgiev"; + repo = "gevent-eventemitter"; + rev = "refs/tags/v${version}"; + hash = "sha256-aW4OsQi3N5yAMdbTd8rxbb2qYMfFJBR4WQFIXvxpiMw="; + }; + + build-system = [ setuptools ]; + dependencies = [ gevent ]; + nativeCheckInputs = [ + coverage + pytestCheckHook + ]; + + meta = { + description = "EventEmitter with gevent"; + homepage = "https://github.com/rossengeorgiev/gevent-eventemitter"; + license = lib.licenses.mit; # https://github.com/rossengeorgiev/gevent-eventemitter/issues/5#issuecomment-2354040386 + maintainers = with lib.maintainers; [ pandapip1 ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 87a0435c5ba6a..048a7c07e70c0 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5095,6 +5095,8 @@ self: super: with self; { geventhttpclient = callPackage ../development/python-modules/geventhttpclient { }; + gevent-eventemitter = callPackage ../development/python-modules/gevent-eventemitter { }; + gevent-socketio = callPackage ../development/python-modules/gevent-socketio { }; gevent-websocket = callPackage ../development/python-modules/gevent-websocket { }; From 294ee03f314b016ab3e5436c2a42fee0b17865a2 Mon Sep 17 00:00:00 2001 From: Gavin John Date: Mon, 16 Sep 2024 12:13:42 -0700 Subject: [PATCH 07/10] python312Packages.steam: init at 1.4.4 --- .../python-modules/steam/default.nix | 59 +++++++++++++++++++ .../steam/whydoesthisneedfixing.patch | 14 +++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 75 insertions(+) create mode 100644 pkgs/development/python-modules/steam/default.nix create mode 100644 pkgs/development/python-modules/steam/whydoesthisneedfixing.patch diff --git a/pkgs/development/python-modules/steam/default.nix b/pkgs/development/python-modules/steam/default.nix new file mode 100644 index 0000000000000..977540cbdcfa3 --- /dev/null +++ b/pkgs/development/python-modules/steam/default.nix @@ -0,0 +1,59 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + fetchpatch, + setuptools, + six, + pycryptodomex, + requests, + vdf, + gevent, + gevent-eventemitter, + protobuf, + cachetools, +}: + +buildPythonPackage rec { + pname = "steam"; + version = "1.4.4"; + pyproject = true; + + src = fetchFromGitHub { + owner = "ValvePython"; + repo = "steam"; + rev = "refs/tags/v${version}"; + hash = "sha256-OY04GsX3KMPvpsQl8sUurzFyJu+JKpES8B0iD6Z5uyw="; + }; + + patches = [ + # https://github.com/ValvePython/steam/pull/466 + /* + (fetchpatch { + url = "https://github.com/ValvePython/steam/commit/e313e05d03cfbb9413cfb279a4a14fa55d0b3c4e.patch"; + hash = "sha256-y1LMwsnMXTVI8RsH07gSNQyKJfubDR+KYAkC8aHIYKw="; + }) + */ + # TypeError: int() argument must be a string, a bytes-like object or a real number, not 'dict' + ./whydoesthisneedfixing.patch + ]; + + build-system = [ setuptools ]; + dependencies = [ + six + pycryptodomex + requests + vdf + gevent + protobuf + gevent-eventemitter + cachetools + ]; + + meta = { + description = "Python package for interacting with Steam"; + homepage = "https://steam.readthedocs.io/en/stable/"; # setup.py links to GitHub, but GitHub links to ReadTheDocs + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ pandapip1 ]; + }; +} diff --git a/pkgs/development/python-modules/steam/whydoesthisneedfixing.patch b/pkgs/development/python-modules/steam/whydoesthisneedfixing.patch new file mode 100644 index 0000000000000..2beeebfa3ea2a --- /dev/null +++ b/pkgs/development/python-modules/steam/whydoesthisneedfixing.patch @@ -0,0 +1,14 @@ +diff --git a/steam/client/cdn.py b/steam/client/cdn.py +index dbd09ab..3762653 100644 +--- a/steam/client/cdn.py ++++ b/steam/client/cdn.py +@@ -836,6 +836,9 @@ class CDNClient(object): + else: + manifest_gid = depot_info.get('manifests', {}).get(branch) + ++ if type(manifest_gid) == dict: ++ manifest_gid = manifest_gid.get('gid') ++ + if manifest_gid is not None: + tasks.append( + self.gpool.spawn( diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 048a7c07e70c0..e52e81258c0b6 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -15209,6 +15209,8 @@ self: super: with self; { stdlibs = callPackage ../development/python-modules/stdlibs { }; + steam = callPackage ../development/python-modules/steam { }; + steamodd = callPackage ../development/python-modules/steamodd { }; steamship = callPackage ../development/python-modules/steamship { }; From 4c96e9ae8f6b9fa5026bb1f33f7bda2bb82a59f4 Mon Sep 17 00:00:00 2001 From: Gavin John Date: Mon, 16 Sep 2024 12:14:01 -0700 Subject: [PATCH 08/10] steamctl: init at 0.9.5 --- pkgs/by-name/st/steamctl/package.nix | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 pkgs/by-name/st/steamctl/package.nix diff --git a/pkgs/by-name/st/steamctl/package.nix b/pkgs/by-name/st/steamctl/package.nix new file mode 100644 index 0000000000000..47478618f9ceb --- /dev/null +++ b/pkgs/by-name/st/steamctl/package.nix @@ -0,0 +1,37 @@ +{ + lib, + python3Packages, + fetchFromGitHub, +}: + +python3Packages.buildPythonApplication rec { + pname = "steamctl"; + version = "0.9.5"; + pyproject = true; + + src = fetchFromGitHub { + owner = "ValvePython"; + repo = "steamctl"; + rev = "refs/tags/v${version}"; + hash = "sha256-reNch5MP31MxyaeKUlANfizOXZXjtIDeSM1kptsWqkc="; + }; + + build-system = with python3Packages; [ setuptools ]; + dependencies = with python3Packages; [ + steam + appdirs + argcomplete + tqdm + arrow + pyqrcode + vpk + beautifulsoup4 + ]; + + meta = { + description = "A CLI utility to interface with Steam"; + homepage = "https://github.com/ValvePython/steamctl"; # GitHub's homepage is set to PyPi listing, PyPi listing's homepage is set to GitHub + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ pandapip1 ]; + }; +} From 052f74a489f10d7e88ee19a28d3183eda014ef05 Mon Sep 17 00:00:00 2001 From: Gavin John Date: Mon, 16 Sep 2024 13:02:46 -0700 Subject: [PATCH 09/10] steamUpdater: init --- pkgs/common-updater/steam-updater.nix | 79 +++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 pkgs/common-updater/steam-updater.nix diff --git a/pkgs/common-updater/steam-updater.nix b/pkgs/common-updater/steam-updater.nix new file mode 100644 index 0000000000000..1c5aeb527d1a6 --- /dev/null +++ b/pkgs/common-updater/steam-updater.nix @@ -0,0 +1,79 @@ +{ + lib, + stdenv, + common-updater-scripts, + coreutils, + depotdownloader, + gnugrep, + gnused, + steamctl, + jq, + nix, + writeScript, +}: + +{ + name ? null, + pname ? null, + version ? null, + attrPath ? null, + # Explicit Steam appId required for the update script to work. + appId ? null, +}: + +let + # shell script to update package + updateScript = writeScript "generic-update-script.sh" '' + #! ${stdenv.shell} + + # Set strict shell mode and enable debugging + set -o errexit + set -x + + # Add utilities to PATH + export PATH=${ + lib.makeBinPath [ + "${common-updater-scripts}/bin" + "${depotdownloader}/bin" + "${gnugrep}/bin" + "${gnused}/bin" + "${jq}/bin" + "${steamctl}/bin" + ] + }:$PATH + + # Get necessary variables + name="$1" + pname="$2" + version="$3" + attr_path="$4" + app_id="$5" + + [[ -n "$name" ]] || name="$UPDATE_NIX_NAME" + [[ -n "$pname" ]] || pname="$UPDATE_NIX_PNAME" + [[ -n "$version" ]] || version="$UPDATE_NIX_OLD_VERSION" + [[ -n "$attr_path" ]] || attr_path="$UPDATE_NIX_ATTR_PATH" + + # Use steamctl to get information about latest depots + APP_INFO=$(steamctl -l quiet --anonymous depot info --app $app_id) + LATEST_VERSION=$(echo $APP_INFO | grep -oP 'Created On: \K[0-9\-]+' | sort -r | head -n 1) + DEPOT_IDS=$(echo $APP_INFO | grep -oP 'Depot ID: \K[0-9]+') + MANIFEST_GIDS=$(echo $APP_INFO | grep -oP 'Manifest GID: \K[0-9]+') + ''; + +in +{ + name = "steam-update-script"; + command = [ + updateScript + name + pname + version + attrPath + appId + ]; + supportedFeatures = [ + # Stdout must contain output according to the updateScript commit protocol when the update script finishes with a non-zero exit code. + "commit" + ]; +} From bf942b5797583883bad561229b5c4ca99afc5f5d Mon Sep 17 00:00:00 2001 From: Gavin John Date: Tue, 10 Sep 2024 13:24:44 -0700 Subject: [PATCH 10/10] steamvr: init --- pkgs/by-name/st/steamvr/PERMISSION.md | 64 +++++++++++ pkgs/by-name/st/steamvr/darwin.nix | 3 + pkgs/by-name/st/steamvr/linux.nix | 148 ++++++++++++++++++++++++++ pkgs/by-name/st/steamvr/package.nix | 7 ++ 4 files changed, 222 insertions(+) create mode 100644 pkgs/by-name/st/steamvr/PERMISSION.md create mode 100644 pkgs/by-name/st/steamvr/darwin.nix create mode 100644 pkgs/by-name/st/steamvr/linux.nix create mode 100644 pkgs/by-name/st/steamvr/package.nix diff --git a/pkgs/by-name/st/steamvr/PERMISSION.md b/pkgs/by-name/st/steamvr/PERMISSION.md new file mode 100644 index 0000000000000..7eb9208a389ca --- /dev/null +++ b/pkgs/by-name/st/steamvr/PERMISSION.md @@ -0,0 +1,64 @@ +From: John, Gavin N. (Gavin) +To: vrlicensing@valvesoftware.com +Subject: Permission to package SteamVR + + +Hi Valve VR folks, + +I'm Gavin, an incoming freshman at Caltech. In my free time, I like to package programs for [nixpkgs](https://github.com/NixOS/nixpkgs), the package repository for the [nix](https://nixos.org/) package manager and its NixOS linux distribution. + +I initially planned to package it by downloading it using depotdownloader, but discovered that SteamVR can't be downloaded in its entirety using anonymous accounts. This led me to discover the [SteamVR licensing page](https://partner.steamgames.com/doc/features/steamvr/enterprise), which had this email address. + +Would you be okay with me modifying and distributing my copy of SteamVR for the purpose of making it available to install through nixpkgs? Nixpkgs has a mechanism to keep track of licenses that users have agreed to, so installation of SteamVR can require agreement to the Steam Subscriber Agreement, the Steam PC Café Agreement, and/or the SteamVR Commercial Installation License. + +Thank you for your consideration! + +Sincerely, + +Gavin John + +--- + +From: Ben Jackson +To: John, Gavin N. (Gavin) +Subject: Re: Permission to package SteamVR + + + * I initially planned to package it by downloading it using depotdownloader, but discovered that SteamVR can't be downloaded in its entirety using anonymous accounts. + +Thanks for bringing this to our attention. I have fixed that issue. + + * Would you be okay with me modifying and distributing my copy of SteamVR for the purpose of making it available to install through nixpkgs? + +We would rather avoid that. I assume if depotdownloader works again, this would no longer be preferably anyway. + +--Ben + +--- + +From: John, Gavin N. (Gavin) +To: Ben Jackson +Subject: [External Mail] Re: Permission to package SteamVR + + +Hi Ben, + +Thank you for your response! Thanks for fixing the issue with depot downloader. That's going to help a lot. + +Some modifications to SteamVR will be necessary to make all functionality work with NixOS. Do I have permission to make a configuration file and script that makes the necessary modifications, and to have the config file and script distributed? + +Thank you! + +Sincerely, + +Gavin + +--- + +From: Ben Jackson +To: "'John, Gavin N. (Gavin)'" +Subject: RE: Permission to package SteamVR + +It's fine to distribute patches that apply after downloading the base content. + +If there are specific issues that you think are generic issues regarding portability you can also send them my way. diff --git a/pkgs/by-name/st/steamvr/darwin.nix b/pkgs/by-name/st/steamvr/darwin.nix new file mode 100644 index 0000000000000..c5933fe581fa7 --- /dev/null +++ b/pkgs/by-name/st/steamvr/darwin.nix @@ -0,0 +1,3 @@ +{ lib }: + +throw "Not yet implemented" diff --git a/pkgs/by-name/st/steamvr/linux.nix b/pkgs/by-name/st/steamvr/linux.nix new file mode 100644 index 0000000000000..bf4771f682b2e --- /dev/null +++ b/pkgs/by-name/st/steamvr/linux.nix @@ -0,0 +1,148 @@ +{ + lib, + stdenvNoCC, + fetchSteam, + autoPatchelfHook, + audit, + bzip2, + expat, + gtk2, + gdk-pixbuf, + glib, + glibc, + libdrm, + libgcc, + libpng12, + libGL, + libusb1, + nspr, + nss, + openal, + SDL2, + vulkan-loader, + xorg, + zlib, + readline63, + rsync, + config, + acceptLicense ? + config.steam.acceptSubscriberAgreement or config.steam.acceptPCCafeAgreement + or config.steamvr.acceptCommercialLicense or true, # TODO: Change true to false once debugged +}: + +stdenvNoCC.mkDerivation { + name = "steamvr-linux"; + + srcs = + assert + !acceptLicense + -> throw '' + Use of SteamVR requires the acceptance of at least one of the following license agreements: + + - Steam Subscriber Agreement [1] + - Steam PC Café Agreement [2] + - SteamVR Commercial License Agreement [3] + + You can express acceptance by setting one of the following options: + + configuration.nix: + nixpkgs.config.steam.acceptSubscriberAgreement = true; # for the Steam Subscriber Agreement + nixpkgs.config.steam.acceptPCCafeAgreement = true; # for the Steam PC Café Agreement + nixpkgs.config.steamvr.acceptCommercialLicense = true; # for the SteamVR Commercial License Agreement + + [1]: https://store.steampowered.com/subscriber_agreement/ + [2]: https://partner.steamgames.com/doc/sitelicense/licensees/signup + [3]: https://partner.steamgames.com/doc/features/steamvr/enterprise + ''; + [ + (fetchSteam { + name = "steamvr-linux-depot"; + app = 250820; + depot = 250823; + manifest = 5747149350848671194; + hash = "sha256-q3jasX/prYhs+Vs7Ofru2N3WVxf/0tGlqTd5SvKRm10="; + }) + (fetchSteam { + name = "openvr-content-1-depot"; + app = 250820; + depot = 250824; + manifest = 5862217504045387455; + hash = "sha256-X4vQdfrbkqkDk+zWeZ9uq0aqa3EDzrUAsMAzQGLhmo8="; + }) + (fetchSteam { + name = "openvr-content-2-depot"; + app = 250820; + depot = 250827; + manifest = 2950592113021695594; + hash = "sha256-5P8FRXAe2ZUsEQxtdVQLjvq8YHWqG1xY6paRDF8fHtc="; + }) + (fetchSteam { + name = "openvr-content-3-depot"; + app = 250820; + depot = 250828; + manifest = 7972087267127211047; + hash = "sha256-nsrYx+/pba38ucDaEXOhrQeTHERegHUSv3MjiOhUdjg="; + }) + (fetchSteam { + name = "openvr-content-4-depot"; + app = 250820; + depot = 250829; + manifest = 1180860512328011191; + hash = "sha256-yf6aSyQ0r1RoFEp5aK9yNPbMN5lZEkLG1Gmr1ffLEsA="; + }) + (fetchSteam { + name = "steamvr-environments-linux-depot"; + app = 250820; + depot = 250829; + manifest = 1180860512328011191; + hash = "sha256-yf6aSyQ0r1RoFEp5aK9yNPbMN5lZEkLG1Gmr1ffLEsA="; + }) + ]; + sourceRoot = "."; + + nativeBuildInputs = [ + autoPatchelfHook + rsync + ]; + buildInputs = + [ + audit + bzip2 + expat + gtk2 + gdk-pixbuf + glib + glibc + libdrm + libgcc.lib + libpng12 + libGL + libusb1 + nspr + nss + openal + readline63 + SDL2 + vulkan-loader + zlib + ] + ++ (with xorg; [ + libX11 + libXext + libXrender + libXi + libXtst + libXdamage + libSM + ]); + + dontConfigure = true; + dontBuild = true; + + installPhase = '' + mkdir -p $out + for src in $srcs; do + rsync -a $src/ $out/ + done + ''; +} diff --git a/pkgs/by-name/st/steamvr/package.nix b/pkgs/by-name/st/steamvr/package.nix new file mode 100644 index 0000000000000..e7b82add6eb76 --- /dev/null +++ b/pkgs/by-name/st/steamvr/package.nix @@ -0,0 +1,7 @@ +{ + lib, + stdenv, + callPackage, +}: + +if stdenv.isDarwin then callPackage ./darwin.nix { } else callPackage ./linux.nix { }