6 # `url` and `urls` should only be overriden via `<pkg>.override`, but not `<pkg>.overrideAttrs`.
11 , url ? if urls == [ ] then abort "Expect either non-empty `urls` or `url`" else lib.head urls
14 , intermediateDestUrls ? [ ]
15 , extraGfalCopyFlags ? [ ]
16 , allowSubstitutes ? true
19 (runCommandLocal name { } ''
20 for u in "''${urls[@]}"; do
21 gfal-copy "''${gfalCopyFlags[@]}" "$u" "''${intermediateDestUrls[@]}" "$out"
26 echo "gfal-copy failed trying to download from any of the urls" >&2
29 '').overrideAttrs (finalAttrs: previousAttrs:
31 __structuredAttrs = true;
32 inherit allowSubstitutes;
33 nativeBuildInputs = [ gfal2-util ];
34 outputHashAlgo = null;
35 outputHashMode = if finalAttrs.recursive then "recursive" else "flat";
38 urls = if urls == [ ] then lib.singleton url else urls;
39 gfalCopyFlags = extraGfalCopyFlags
40 ++ lib.optional finalAttrs.recursive "--recursive"
42 inherit recursive intermediateDestUrls;
43 } // (if (pname != "" && version != "") then {
44 inherit pname version;
45 name = "${finalAttrs.pname}-${finalAttrs.version}";
47 name = if (name != "") then name else (baseNameOf url);