diff options
Diffstat (limited to 'srcds-pkgs')
-rw-r--r-- | srcds-pkgs/depotdownloader-json/2_7/0001-NO-NO-AND-NO.patch | 59 | ||||
-rw-r--r-- | srcds-pkgs/depotdownloader-json/default.nix | 88 |
2 files changed, 137 insertions, 10 deletions
diff --git a/srcds-pkgs/depotdownloader-json/2_7/0001-NO-NO-AND-NO.patch b/srcds-pkgs/depotdownloader-json/2_7/0001-NO-NO-AND-NO.patch new file mode 100644 index 0000000..27d55f9 --- /dev/null +++ b/srcds-pkgs/depotdownloader-json/2_7/0001-NO-NO-AND-NO.patch @@ -0,0 +1,59 @@ +From 541f9e712491a358511f8c5efdff039429f78222 Mon Sep 17 00:00:00 2001 +From: yuuko <yuuko@partyvan.io> +Date: Sun, 24 Nov 2024 01:21:48 -0800 +Subject: [PATCH] NO, NO, AND NO. + +--- + SteamKit2/SteamKit2/Util/HardwareUtils.cs | 36 +---------------------- + 1 file changed, 1 insertion(+), 35 deletions(-) + +diff --git a/SteamKit2/SteamKit2/Util/HardwareUtils.cs b/SteamKit2/SteamKit2/Util/HardwareUtils.cs +index 78f36466..7c7b942b 100644 +--- a/SteamKit2/SteamKit2/Util/HardwareUtils.cs ++++ b/SteamKit2/SteamKit2/Util/HardwareUtils.cs +@@ -276,41 +276,7 @@ namespace SteamKit2 + + static List<byte[]> GetMacAddresses( bool checkForPhysicalDevice = true ) + { +- var netDirectories = Directory.GetDirectories( "/sys/class/net" ); +- var macs = new List<byte[]>(); +- +- // if /sys/class/net can't be open or is empty, "/proc/net/dev" could be read here +- +- foreach ( var directory in netDirectories ) +- { +- var iface = Path.GetFileName( directory ); +- +- if ( checkForPhysicalDevice && !Directory.Exists( $"/sys/class/net/{iface}/device" ) ) +- { +- continue; +- } +- +- try +- { +- // ioctl could be attempted to read the mac address here +- // Loopback mac address will be decoded to zero here +- var addressText = File.ReadAllText( $"/sys/class/net/{iface}/address" ); +- var macAddress = Convert.FromHexString( addressText.Replace( ":", "" ).AsSpan().Trim() ); +- +- macs.Add( macAddress ); +- } +- catch +- { +- // if we can't read a file, continue to the next +- } +- } +- +- if ( checkForPhysicalDevice && macs.Count == 0 ) +- { +- return GetMacAddresses( checkForPhysicalDevice: false ); +- } +- +- return macs; ++ return new List<byte[]>(); + } + } + +-- +2.47.0 + diff --git a/srcds-pkgs/depotdownloader-json/default.nix b/srcds-pkgs/depotdownloader-json/default.nix index 0f6f4c4..a447aa3 100644 --- a/srcds-pkgs/depotdownloader-json/default.nix +++ b/srcds-pkgs/depotdownloader-json/default.nix @@ -1,19 +1,87 @@ -{ depotdownloader }: -depotdownloader.overrideAttrs({ patches ? [], version, ... }: { - patches = if builtins.elem version [ "2.4.7" "2.5.0"] then - [ +{ depotdownloader, callPackage, fetchNuGet, ed }: +depotdownloader.overrideAttrs ( +{ patches ? [] +, buildInputs +, nativeBuildInputs ? [] +, passthru ? {} +, version +, ... +}: +let + # see 2.7.3 below + "SteamKit2" = callPackage ( + { lib, buildDotnetModule + , fetchFromGitHub, fetchNuGet + , dotnetCorePackages + , ed }: + buildDotnetModule rec { + pname = "SteamKit2"; + version = "3.0.0-Beta.4"; + src = fetchFromGitHub { + owner = "SteamRE"; + repo = "SteamKit"; + rev = version; + hash = "sha256-m4ppH3pTCeqs0PrUTVDErqq94CK0XCTWIvTLy1Ll2Cs="; + }; + + projectFile = "SteamKit2/SteamKit2.sln"; + + nugetDeps = buildInputs; + nativeBuildInputs = [ ed ]; + dotnet-sdk = dotnetCorePackages.sdk_8_0; + dotnet-runtime = dotnetCorePackages.runtime_8_0; + + patches = [ ./2_7/0001-NO-NO-AND-NO.patch ]; + postPatch = '' + # nuclear option because tests pull in extra deps + rm -rf SteamKit2/Tests + ed ${projectFile} <<EOF + /Tests/;/EndProject/d + w + EOF + ''; + + packNupkg = true; + } + ) {}; + replacePkgInList = n: v: l: let + toAttrs = builtins.listToAttrs + (map (p: { name = p.pname; value = p; }) l); + in builtins.attrValues (toAttrs // { + ${n} = v; + }); + replaceSK2 = replacePkgInList "SteamKit2" SteamKit2; +in +if builtins.elem version [ "2.4.7" "2.5.0" ] then + { + patches = [ # with this, nix has access to the hashes in the manifest ./2_5/0001-emit-json-in-.DepotDownload.patch # the manifest can arrive out of order across requests to the same build! # luckily that singular reproducibility snag is patched in 1 line. ./2_5/0002-ProtoManifest-sort-files-in-constructor.patch - ] - else if builtins.elem version [ "2.7.3" ] then - [ + ]; + } +# the underlying version of steamkit2 here is kinda busted for nix purposes +# so we have to get up to some crimes against humanity +else if builtins.elem version [ "2.7.3" ] then + { + patches = [ ./2_7/0001-ProtoManifest-sort-files-in-constructor.patch ./2_7/0002-emit-json-in-.DepotDownload.patch # formatting very the epic ./2_7/0003-thats-just-like-your-opinion-man.patch - ] - else builtins.abort "version of DepotDownloader not covered by patches"; -}) + ]; + nugetDeps = replaceSK2 passthru.nugetDeps; + buildInputs = replaceSK2 buildInputs; + nativeBuildInputs = nativeBuildInputs ++ [ ed ]; + postPatch = '' + ed DepotDownloader/DepotDownloader.csproj <<EOF + /SteamKit2/s/-[Bb]eta.[0-9]*// + w + EOF + ''; + } +else builtins.abort "version of DepotDownloader not covered by patches" +) + |