summary refs log tree commit diff
path: root/pkgs/servers/mirrorbits/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/servers/mirrorbits/default.nix')
-rw-r--r--pkgs/servers/mirrorbits/default.nix53
1 files changed, 26 insertions, 27 deletions
diff --git a/pkgs/servers/mirrorbits/default.nix b/pkgs/servers/mirrorbits/default.nix
index 759ac94e568..b85be770e79 100644
--- a/pkgs/servers/mirrorbits/default.nix
+++ b/pkgs/servers/mirrorbits/default.nix
@@ -1,42 +1,41 @@
-{ lib, buildGoPackage, fetchFromGitHub, fetchpatch
-, pkg-config, zlib, geoip }:
-
-buildGoPackage rec {
+{ lib
+, buildGoModule
+, fetchFromGitHub
+, fetchpatch
+, pkg-config
+, zlib
+, geoip
+}:
+
+buildGoModule rec {
   pname = "mirrorbits";
-  version = "0.4";
-  rev = "v${version}";
+  version = "0.5.1";
 
   src = fetchFromGitHub {
-    inherit rev;
     owner = "etix";
     repo = "mirrorbits";
-    sha256 = "11f9wczajba147qk5j73pxjrvlxkgr598sjvgjn2b8nxm49g2pan";
+    rev = "v${version}";
+    hash = "sha256-Ta3+Y3P74cvx09Z4rB5ObgBZtfF4grVgyeZ57yFPlGM=";
   };
 
+  vendorHash = null;
+
   patches = [
+    # Add Go Modules support
     (fetchpatch {
-      url = "https://github.com/etix/mirrorbits/commit/03a4e02214bdb7bb60240ddf25b887ccac5fb118.patch";
-      sha256 = "08332cfxmp2nsfdj2ymg3lxkav8h44f6cf2h6g9jkn03mkliblm5";
+      url = "https://github.com/etix/mirrorbits/commit/955a8b2e1aacea1cae06396a64afbb531ceb36d4.patch";
+      hash = "sha256-KJgj3ynnjjiXG5qsUmzBiMjGEwfvM/9Ap+ZgUdhclik=";
     })
   ];
 
-  postPatch = ''
-    rm -rf testing
-  '';
-
-  # Fix build with go >=1.12
-  preBuild = ''
-    sed -i s/"_Ctype_struct_GeoIPRecordTag"/"C.struct_GeoIPRecordTag"/ ./go/src/github.com/etix/geoip/geoip.go
-  '';
-
-  goPackagePath = "github.com/etix/mirrorbits";
-  deleteVendor = true;
-  goDeps = ./deps.nix;
-
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ zlib geoip ];
 
-  meta = {
+  subPackages = [ "." ];
+
+  ldflags = [ "-s" "-w" ];
+
+  meta = with lib; {
     description = "geographical download redirector for distributing files efficiently across a set of mirrors";
     homepage = "https://github.com/etix/mirrorbits";
     longDescription = ''
@@ -47,8 +46,8 @@ buildGoPackage rec {
       the distribution of large-scale Open-Source projects with a lot
       of traffic.
     '';
-    license = lib.licenses.mit;
-    maintainers = with lib.maintainers; [ fpletz ];
-    platforms = lib.platforms.unix;
+    license = licenses.mit;
+    maintainers = with maintainers; [ fpletz ];
+    platforms = platforms.unix;
   };
 }