fetchurl: add passthru resolvedUrl (#398843)

authored by Sandro and committed by GitHub 16a1a883 b3ac63b5

+13 -1
+13 -1
pkgs/build-support/fetchurl/default.nix
··· 192 192 } 193 193 else 194 194 throw "fetchurl requires a hash for fixed-output derivation: ${lib.generators.toPretty urls_}"; 195 + 196 + resolvedUrl = 197 + let 198 + mirrorSplit = lib.match "mirror://([[:alpha:]]+)/(.+)" url; 199 + mirrorName = lib.head mirrorSplit; 200 + mirrorList = 201 + if lib.hasAttr mirrorName mirrors then 202 + mirrors."${mirrorName}" 203 + else 204 + throw "unknown mirror:// site ${mirrorName}"; 205 + in 206 + if mirrorName == null then url else "${lib.head mirrorList}${lib.elemAt mirrorSplit 1}"; 195 207 in 196 208 197 209 assert ··· 279 291 280 292 inherit meta; 281 293 passthru = { 282 - inherit url; 294 + inherit url resolvedUrl; 283 295 } 284 296 // passthru; 285 297 }