Unverified Commit 16a1a883 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

fetchurl: add passthru resolvedUrl (#398843)

parents b3ac63b5 aa9a2250
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -192,6 +192,18 @@ let
      }
    else
      throw "fetchurl requires a hash for fixed-output derivation: ${lib.generators.toPretty urls_}";

  resolvedUrl =
    let
      mirrorSplit = lib.match "mirror://([[:alpha:]]+)/(.+)" url;
      mirrorName = lib.head mirrorSplit;
      mirrorList =
        if lib.hasAttr mirrorName mirrors then
          mirrors."${mirrorName}"
        else
          throw "unknown mirror:// site ${mirrorName}";
    in
    if mirrorName == null then url else "${lib.head mirrorList}${lib.elemAt mirrorSplit 1}";
in

assert
@@ -279,7 +291,7 @@ stdenvNoCC.mkDerivation (

    inherit meta;
    passthru = {
      inherit url;
      inherit url resolvedUrl;
    }
    // passthru;
  }