forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / build-support / fetchurl / boot.nix
blob4aa76094a843e8cb236d152ee0363d629daf6866
1 let
2   mirrors = import ./mirrors.nix;
3 in
5 { system }:
8   url ? builtins.head urls,
9   urls ? [ ],
10   sha256 ? "",
11   hash ? "",
12   name ? baseNameOf (toString url),
15 # assert exactly one hash is set
16 assert hash != "" || sha256 != "";
17 assert hash != "" -> sha256 == "";
19 import <nix/fetchurl.nix> {
20   inherit
21     system
22     hash
23     sha256
24     name
25     ;
27   url =
28     # Handle mirror:// URIs. Since <nix/fetchurl.nix> currently
29     # supports only one URI, use the first listed mirror.
30     let
31       m = builtins.match "mirror://([a-z]+)/(.*)" url;
32     in
33     if m == null then url else builtins.head (mirrors.${builtins.elemAt m 0}) + (builtins.elemAt m 1);