1 # This expression returns a list of all fetchurl calls used by ‘expr’.
3 { expr, lib ? import ../../lib }:
23 uniqueFiles = map (x: x.file) (genericClosure {
24 startSet = map (file: { key = with file; (if type == null then "" else type + "+") + hash; inherit file; }) files;
28 files = map (drv: { urls = drv.urls or [ drv.url ]; hash = drv.outputHash; isPatch = (drv?postFetch && drv.postFetch != ""); type = drv.outputHashAlgo; name = drv.name; }) fetchurlDependencies;
30 fetchurlDependencies =
32 (drv: drv.outputHash or "" != "" && drv.outputHashMode or "flat" == "flat"
33 && (drv ? url || drv ? urls))
36 dependencies = map (x: x.value) (genericClosure {
37 startSet = map keyDrv (derivationsIn' root);
38 operator = { key, value }: map keyDrv (immediateDependenciesOf value);
43 else if isDerivation x then optional (canEval x.drvPath) x
44 else if isList x then concatLists (map derivationsIn' x)
45 else if isAttrs x then concatLists (mapAttrsToList (n: v: addErrorContext "while finding tarballs in '${n}':" (derivationsIn' v)) x)
48 keyDrv = drv: if canEval drv.drvPath then { key = drv.drvPath; value = drv; } else { };
50 immediateDependenciesOf = drv:
51 concatLists (mapAttrsToList (n: v: derivationsIn v) (removeAttrs drv (["meta" "passthru"] ++ optionals (drv?passthru) (attrNames drv.passthru))));
55 else if isDerivation x then optional (canEval x.drvPath) x
56 else if isList x then concatLists (map derivationsIn x)
59 canEval = val: (builtins.tryEval val).success;