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,37 +20,12 @@
|
|||
pkgsCross,
|
||||
requireFile,
|
||||
}: 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;
|
||||
fetchSupported = elem system depotdownloader.meta.platforms;
|
||||
fetcher = input:
|
||||
if fetchSupported
|
||||
then
|
||||
fetchSteam {
|
||||
name = "steam-depot-${toString input.app_id}-${toString input.depot_id}";
|
||||
callPackage ./depot.nix {
|
||||
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;
|
||||
usedManifests = filter manifestUsed depotInputs;
|
||||
|
|
|
|||
|
|
@ -3,19 +3,39 @@
|
|||
fetchSteam,
|
||||
appId,
|
||||
depotId,
|
||||
hash ? null,
|
||||
system,
|
||||
depotdownloader,
|
||||
stdenvNoCC,
|
||||
writeScript,
|
||||
}: let
|
||||
inherit (lib) toString importJSON findFirst;
|
||||
inherit (lib) toString importJSON findFirst elem;
|
||||
fetchSupported = elem system depotdownloader.meta.platforms;
|
||||
depotInputs = importJSON ./depots.json;
|
||||
depotInput = findFirst (depot: depot.app_id == appId && depot.depot_id == depotId) {} depotInputs;
|
||||
in
|
||||
if fetchSupported
|
||||
then
|
||||
fetchSteam {
|
||||
name = "steam-depot-${toString appId}-${toString depotId}";
|
||||
inherit appId depotId;
|
||||
manifestId = depotInput.manifest;
|
||||
hash =
|
||||
if (hash == null)
|
||||
then depotInput.hash
|
||||
else hash;
|
||||
hash = depotInput.hash;
|
||||
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