File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed
Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 44} : let
55 inherit ( pkgs ) lib ;
66 sources = builtins . fromJSON ( lib . strings . fileContents ./sources.json ) ;
7+ mirrors = builtins . fromJSON ( lib . strings . fileContents ./mirrors.json ) ;
78
89 # mkBinaryInstall makes a derivation that installs Zig from a binary.
910 mkBinaryInstall = {
1011 url ,
1112 version ,
1213 sha256 ,
13- } :
14+ } : let
15+ tarballName = lib . lists . last ( lib . strings . split "/" url ) ;
16+ srcIsFromZigLang = lib . strings . hasPrefix "https://ziglang.org/" url ;
17+ urlFromMirrors =
18+ builtins . map
19+ ( mirror : "${ mirror } /${ tarballName } ?source=nix-zig-overlay" )
20+ mirrors ;
21+ urls =
22+ if srcIsFromZigLang
23+ then urlFromMirrors ++ [ url ]
24+ else [ url ] ;
25+ in
1426 pkgs . stdenv . mkDerivation {
1527 inherit version ;
1628
1729 pname = "zig" ;
18- src = pkgs . fetchurl { inherit url sha256 ; } ;
30+ src = pkgs . fetchurl { inherit urls sha256 ; } ;
1931 dontConfigure = true ;
2032 dontBuild = true ;
2133 dontFixup = true ;
Original file line number Diff line number Diff line change 1+ [
2+ " https://pkg.machengine.org/zig" ,
3+ " https://zigmirror.hryx.net/zig" ,
4+ " https://zig.linus.dev/zig" ,
5+ " https://zig.squirl.dev" ,
6+ " https://zig.florent.dev" ,
7+ " https://zig.mirror.mschae23.de/zig" ,
8+ " https://zigmirror.meox.dev"
9+ ]
Original file line number Diff line number Diff line change 22#! nix-shell -p curl jq minisign -i sh
33set -e
44
5+ curl -s 'https://ziglang.org/download/community-mirrors.txt' | jq -R '.' | jq -s . > mirrors.json
6+
57# The well known public key for Zig
68PUBLIC_KEY="RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U"
79
You can’t perform that action at this time.
0 commit comments