nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, buildGoPackage, fetchFromGitHub, fetchpatch
2, pkgconfig, zlib, geoip }:
3
4buildGoPackage rec {
5 pname = "mirrorbits";
6 version = "0.4";
7 rev = "v${version}";
8
9 src = fetchFromGitHub {
10 inherit rev;
11 owner = "etix";
12 repo = "mirrorbits";
13 sha256 = "11f9wczajba147qk5j73pxjrvlxkgr598sjvgjn2b8nxm49g2pan";
14 };
15
16 patches = [
17 (fetchpatch {
18 url = "https://github.com/etix/mirrorbits/commit/03a4e02214bdb7bb60240ddf25b887ccac5fb118.patch";
19 sha256 = "08332cfxmp2nsfdj2ymg3lxkav8h44f6cf2h6g9jkn03mkliblm5";
20 })
21 ];
22
23 postPatch = ''
24 rm -rf testing
25 '';
26
27 # Fix build with go >=1.12
28 preBuild = ''
29 sed -i s/"_Ctype_struct_GeoIPRecordTag"/"C.struct_GeoIPRecordTag"/ ./go/src/github.com/etix/geoip/geoip.go
30 '';
31
32 goPackagePath = "github.com/etix/mirrorbits";
33 goDeps = ./deps.nix;
34
35 nativeBuildInputs = [ pkgconfig ];
36 buildInputs = [ zlib geoip ];
37
38 meta = {
39 description = "geographical download redirector for distributing files efficiently across a set of mirrors";
40 homepage = "https://github.com/etix/mirrorbits";
41 longDescription = ''
42 Mirrorbits is a geographical download redirector written in Go for
43 distributing files efficiently across a set of mirrors. It offers
44 a simple and economic way to create a Content Delivery Network
45 layer using a pure software stack. It is primarily designed for
46 the distribution of large-scale Open-Source projects with a lot
47 of traffic.
48 '';
49 license = lib.licenses.mit;
50 maintainers = with lib.maintainers; [ fpletz ];
51 platforms = lib.platforms.unix;
52 };
53}