1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
{ 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
];
}
# 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
];
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"
)
|