diff options
author | yuuko <yuuko@partyvan.io> | 2024-08-29 21:51:04 -0700 |
---|---|---|
committer | yuuko <yuuko@partyvan.io> | 2024-08-29 21:51:04 -0700 |
commit | 56449e59d7aabd1c06fb67a51a1e129b55cb9270 (patch) | |
tree | 19f3faf805e9b6461a5940d1a050d13e5271ef55 /srcds-pkgs/mkdepot.nix |
break out of system config
Diffstat (limited to 'srcds-pkgs/mkdepot.nix')
-rw-r--r-- | srcds-pkgs/mkdepot.nix | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/srcds-pkgs/mkdepot.nix b/srcds-pkgs/mkdepot.nix new file mode 100644 index 0000000..8c1acaa --- /dev/null +++ b/srcds-pkgs/mkdepot.nix @@ -0,0 +1,19 @@ +{ lib, runCommand, fetchDepotFile }: +name: caches: ps: +with lib; +let + emitStep = { FileName, Flags, Chunks, ... }@file: + if bitAnd Flags 64 != 0 || Chunks == [] then '' + mkdir -p $out/'${FileName}' + '' else let drv = fetchDepotFile file; in '' + mkdir -p $out/'${drv.passthru.dirname}' + ln -s '${drv}' $out/'${FileName}' + ''; + emitManifest = cache: with cache.passthru; let + json = "${cache}/.DepotDownloader/${toString depot}_${manifest}.json"; + mkStep = file: emitStep (file // { inherit cache; }); + in concatMapStrings mkStep (importJSON json).Files; +in runCommand name {} '' + ${concatMapStringsSep "\n" emitManifest caches} + ${ps} +'' |