1# This expression returns a list of all fetchurl calls used by all
2# packages reachable from release.nix.
3
4with import ../.. { };
5with lib;
6
7let
8
9 root = removeAttrs (import ../../pkgs/top-level/release.nix { }) [ "tarball" "unstable" ];
10
11 uniqueUrls = map (x: x.file) (genericClosure {
12 startSet = map (file: { key = file.url; inherit file; }) urls;
13 operator = const [ ];
14 });
15
16 urls = map (drv: { url = head drv.urls; hash = drv.outputHash; type = drv.outputHashAlgo; }) fetchurlDependencies;
17
18 fetchurlDependencies = filter (drv: drv.outputHash or "" != "" && drv ? urls) dependencies;
19
20 dependencies = map (x: x.value) (genericClosure {
21 startSet = map keyDrv (derivationsIn' root);
22 operator = { key, value }: map keyDrv (immediateDependenciesOf value);
23 });
24
25 derivationsIn' = x:
26 if !canEval x then []
27 else if isDerivation x then optional (canEval x.drvPath) x
28 else if isList x then concatLists (map derivationsIn' x)
29 else if isAttrs x then concatLists (mapAttrsToList (n: v: derivationsIn' v) x)
30 else [ ];
31
32 keyDrv = drv: if canEval drv.drvPath then { key = drv.drvPath; value = drv; } else { };
33
34 immediateDependenciesOf = drv:
35 concatLists (mapAttrsToList (n: v: derivationsIn v) (removeAttrs drv ["meta" "passthru"]));
36
37 derivationsIn = x:
38 if !canEval x then []
39 else if isDerivation x then optional (canEval x.drvPath) x
40 else if isList x then concatLists (map derivationsIn x)
41 else [ ];
42
43 canEval = val: (builtins.tryEval val).success;
44
45in uniqueUrls