mirror of
https://codeberg.org/spire/nix.git
synced 2026-08-02 12:25:00 +02:00
dedub depot logic
This commit is contained in:
parent
7dc7a7c1cb
commit
b3c3245b4c
2 changed files with 37 additions and 42 deletions
|
|
@ -20,38 +20,13 @@
|
||||||
pkgsCross,
|
pkgsCross,
|
||||||
requireFile,
|
requireFile,
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) importJSON map toString elem last replaceStrings naturalSort filter any optionals optionalString;
|
inherit (lib) importJSON map last replaceStrings naturalSort filter any optionals optionalString;
|
||||||
depotInputs = importJSON ./depots.json;
|
depotInputs = importJSON ./depots.json;
|
||||||
fetchSupported = elem system depotdownloader.meta.platforms;
|
|
||||||
fetcher = input:
|
fetcher = input:
|
||||||
if fetchSupported
|
callPackage ./depot.nix {
|
||||||
then
|
appId = input.app_id;
|
||||||
fetchSteam {
|
depotId = input.depot_id;
|
||||||
name = "steam-depot-${toString input.app_id}-${toString input.depot_id}";
|
};
|
||||||
appId = input.app_id;
|
|
||||||
depotId = input.depot_id;
|
|
||||||
manifestId = input.manifest;
|
|
||||||
fileList = input.file_list or [];
|
|
||||||
hash = input.hash;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
stdenvNoCC.mkDerivation {
|
|
||||||
name = "steam-depot-${toString input.app_id}-${toString input.depot_id}-depot";
|
|
||||||
outputHashAlgo = "sha256";
|
|
||||||
outputHashMode = "recursive";
|
|
||||||
outputHash = input.hash;
|
|
||||||
builder = writeScript "restrict-message" ''
|
|
||||||
source ${stdenvNoCC}/setup
|
|
||||||
cat <<_EOF_
|
|
||||||
|
|
||||||
$out
|
|
||||||
fetchSteam is not supported on your platform.
|
|
||||||
You can build srcds for x86_64-linux first to fetch the depot.
|
|
||||||
|
|
||||||
_EOF_
|
|
||||||
exit 1
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
manifestUsed = manifest: any (depot: manifest.app_id == depot.app_id && manifest.depot_id == depot.depot_id) depots;
|
manifestUsed = manifest: any (depot: manifest.app_id == depot.app_id && manifest.depot_id == depot.depot_id) depots;
|
||||||
usedManifests = filter manifestUsed depotInputs;
|
usedManifests = filter manifestUsed depotInputs;
|
||||||
allDepots = map fetcher usedManifests;
|
allDepots = map fetcher usedManifests;
|
||||||
|
|
|
||||||
|
|
@ -3,19 +3,39 @@
|
||||||
fetchSteam,
|
fetchSteam,
|
||||||
appId,
|
appId,
|
||||||
depotId,
|
depotId,
|
||||||
hash ? null,
|
system,
|
||||||
|
depotdownloader,
|
||||||
|
stdenvNoCC,
|
||||||
|
writeScript,
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) toString importJSON findFirst;
|
inherit (lib) toString importJSON findFirst elem;
|
||||||
|
fetchSupported = elem system depotdownloader.meta.platforms;
|
||||||
depotInputs = importJSON ./depots.json;
|
depotInputs = importJSON ./depots.json;
|
||||||
depotInput = findFirst (depot: depot.app_id == appId && depot.depot_id == depotId) {} depotInputs;
|
depotInput = findFirst (depot: depot.app_id == appId && depot.depot_id == depotId) {} depotInputs;
|
||||||
in
|
in
|
||||||
fetchSteam {
|
if fetchSupported
|
||||||
name = "steam-depot-${toString appId}-${toString depotId}";
|
then
|
||||||
inherit appId depotId;
|
fetchSteam {
|
||||||
manifestId = depotInput.manifest;
|
name = "steam-depot-${toString appId}-${toString depotId}";
|
||||||
hash =
|
inherit appId depotId;
|
||||||
if (hash == null)
|
manifestId = depotInput.manifest;
|
||||||
then depotInput.hash
|
hash = depotInput.hash;
|
||||||
else hash;
|
fileList = depotInput.file_list or [];
|
||||||
fileList = depotInput.file_list or [];
|
}
|
||||||
}
|
else
|
||||||
|
stdenvNoCC.mkDerivation {
|
||||||
|
name = "steam-depot-${toString appId}-${toString depotId}-depot";
|
||||||
|
outputHashAlgo = "sha256";
|
||||||
|
outputHashMode = "recursive";
|
||||||
|
outputHash = depotInput.hash;
|
||||||
|
builder = writeScript "restrict-message" ''
|
||||||
|
source ${stdenvNoCC}/setup
|
||||||
|
cat <<_EOF_
|
||||||
|
|
||||||
|
fetchSteam is not supported on your platform.
|
||||||
|
You can build for x86_64-linux first to fetch the depot.
|
||||||
|
|
||||||
|
_EOF_
|
||||||
|
exit 1
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue