make srcds derivation configurable

This commit is contained in:
Robin Appelman 2026-07-09 17:28:48 +02:00
commit b848ca3bc9
2 changed files with 17 additions and 4 deletions

View file

@ -12,9 +12,9 @@
system, system,
callPackage, callPackage,
srcds-tf2, srcds-tf2,
sourcemod, depots,
}: let }: let
inherit (lib) importJSON map toString elem last replaceStrings naturalSort; inherit (lib) importJSON map toString elem last replaceStrings naturalSort filter any;
depotInputs = importJSON ./depots.json; depotInputs = importJSON ./depots.json;
fetchSupported = elem system depotdownloader.meta.platforms; fetchSupported = elem system depotdownloader.meta.platforms;
fetcher = input: fetcher = input:
@ -47,7 +47,9 @@
exit 1 exit 1
''; '';
}; };
allDepots = map fetcher depotInputs; manifestUsed = manifest: any (depot: manifest.app_id == depot.app_id && manifest.depot_id == depot.depot_id) depots;
usedManifests = filter manifestUsed depotInputs;
allDepots = map fetcher usedManifests;
src = symlinkJoin { src = symlinkJoin {
name = "srcds-tf2-src"; name = "srcds-tf2-src";
paths = allDepots; paths = allDepots;

View file

@ -2,7 +2,18 @@ final: prev: let
inherit (prev.lib) toString importJSON listToAttrs map; inherit (prev.lib) toString importJSON listToAttrs map;
depotInputs = importJSON ./depots.json; depotInputs = importJSON ./depots.json;
in { in {
srcds-tf2 = final.callPackage ./default.nix {}; srcds-tf2 = final.callPackage ./default.nix {
depots = [
{
app_id = 232250;
depot_id = 232256;
}
{
app_id = 232250;
depot_id = 232250;
}
];
};
steam-depots = listToAttrs (map (depot: { steam-depots = listToAttrs (map (depot: {
name = "steam-depot-${toString depot.app_id}-${toString depot.depot_id}"; name = "steam-depot-${toString depot.app_id}-${toString depot.depot_id}";
value = final.callPackage ./depot.nix { value = final.callPackage ./depot.nix {