# as nice as it would be to just put the file in its expected directory # structure and symlinkJoin them together at the end, creating that structure # sacrifices the use of steam's hashes -- nix hashing isn't hierarchical # or anything, just "archive everything and hash it like another flat file". { lib, runCommand , depotdownloader, cacert }: { FileName, FileHash, Flags, cache, ... }: with lib; assert !hasPrefix "/" FileName; let dirname = dirOf FileName; basename = baseNameOf FileName; src = runCommand basename { inherit (cache.passthru) app depot manifest; inherit basename dirname FileName; cache = "${cache}"; passthru = { inherit dirname basename; }; nativeBuildInputs = [ depotdownloader cacert ]; outputHashMode = "flat"; outputHashAlgo = "sha1"; outputHash = FileHash; } '' export HOME=$PWD cp -r $cache/.DepotDownloader ./ chmod -R 777 .DepotDownloader DepotDownloader \ -app $app -depot $depot -manifest $manifest \ -filelist <(echo "$FileName") -dir . mv $FileName $out chmod -x $out ''; # nix refuses to flat hash executables lol in if bitAnd Flags 32 != 0 then runCommand src.name { inherit src; inherit (src) passthru; } '' cp $src $out chmod +x $out '' else src