7 # `url` and `urls` should only be overriden via `<pkg>.override`, but not `<pkg>.overrideAttrs`.
13 url ? if urls == [ ] then abort "Expect either non-empty `urls` or `url`" else lib.head urls,
16 intermediateDestUrls ? [ ],
17 extraGfalCopyFlags ? [ ],
18 allowSubstitutes ? true,
21 (runCommandLocal name { } ''
22 for u in "''${urls[@]}"; do
23 gfal-copy "''${gfalCopyFlags[@]}" "$u" "''${intermediateDestUrls[@]}" "$out"
28 echo "gfal-copy failed trying to download from any of the urls" >&2
33 finalAttrs: previousAttrs:
35 __structuredAttrs = true;
36 inherit allowSubstitutes;
37 nativeBuildInputs = [ gfal2-util ];
38 outputHashAlgo = null;
39 outputHashMode = if finalAttrs.recursive then "recursive" else "flat";
42 urls = if urls == [ ] then lib.singleton url else urls;
43 gfalCopyFlags = extraGfalCopyFlags ++ lib.optional finalAttrs.recursive "--recursive";
44 inherit recursive intermediateDestUrls;
47 if (pname != "" && version != "") then
49 inherit pname version;
50 name = "${finalAttrs.pname}-${finalAttrs.version}";
53 { name = if (name != "") then name else (baseNameOf url); }