From 164929985029b1ee1a9a9271ba606a4667a633a0 Mon Sep 17 00:00:00 2001 From: Aaron Jheng Date: Fri, 27 Jan 2023 10:17:05 +0000 Subject: [PATCH] mirrorbits: 0.4 -> 0.5.1 --- pkgs/servers/mirrorbits/default.nix | 51 +++++++++++----------- pkgs/servers/mirrorbits/deps.nix | 66 ----------------------------- 2 files changed, 25 insertions(+), 92 deletions(-) delete mode 100644 pkgs/servers/mirrorbits/deps.nix diff --git a/pkgs/servers/mirrorbits/default.nix b/pkgs/servers/mirrorbits/default.nix index 759ac94e568c..b85be770e791 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 }: +{ lib +, buildGoModule +, fetchFromGitHub +, fetchpatch +, pkg-config +, zlib +, geoip +}: -buildGoPackage rec { +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; }; } diff --git a/pkgs/servers/mirrorbits/deps.nix b/pkgs/servers/mirrorbits/deps.nix deleted file mode 100644 index 373654126614..000000000000 --- a/pkgs/servers/mirrorbits/deps.nix +++ /dev/null @@ -1,66 +0,0 @@ -# This file was generated by https://github.com/kamilchm/go2nix v1.2.1 -[ - { - goPackagePath = "github.com/etix/geoip"; - fetch = { - type = "git"; - url = "https://github.com/etix/geoip"; - rev = "db8457352061099b2a1840c712b3223900216588"; - sha256 = "1768237bngcjgw0s8wba0f4nw1xahg28cq2nd6vrbmhavd1ppim9"; - }; - } - { - goPackagePath = "github.com/etix/goftp"; - fetch = { - type = "git"; - url = "https://github.com/etix/goftp"; - rev = "0c13163a1028e83f0f1cce113dddd3900e935bc7"; - sha256 = "15kwk57yk63j28d1lwrykc9nr7ickqgk2fpw4g0b0404b95l101k"; - }; - } - { - goPackagePath = "github.com/garyburd/redigo"; - fetch = { - type = "git"; - url = "https://github.com/garyburd/redigo"; - rev = "70e1b1943d4fc9c56791abaa6f4d1e727b9ab925"; - sha256 = "1nw22r0vagmayjg51rz55yi9ppkd60ya0nzmp113mcz25vhxa0d0"; - }; - } - { - goPackagePath = "github.com/op/go-logging"; - fetch = { - type = "git"; - url = "https://github.com/op/go-logging"; - rev = "970db520ece77730c7e4724c61121037378659d9"; - sha256 = "1cpna2x5l071z1vrnk7zipdkka8dzwsjyx7m79xk0lr08rip0kcj"; - }; - } - { - goPackagePath = "github.com/youtube/vitess"; - fetch = { - type = "git"; - url = "https://github.com/youtube/vitess"; - rev = "6cf14dbf97f28eebd37dc2bc36374852946336a8"; - sha256 = "1g76q84wipyprn05brpjxf8xri87293r7nyf647crjy5d9k950lz"; - }; - } - { - goPackagePath = "gopkg.in/tylerb/graceful.v1"; - fetch = { - type = "git"; - url = "https://gopkg.in/tylerb/graceful.v1"; - rev = "4654dfbb6ad53cb5e27f37d99b02e16c1872fbbb"; - sha256 = "1qspbrzr3h6c89v75c99avn7iizkfnjh901wp650vyy0j3p6ydnd"; - }; - } - { - goPackagePath = "gopkg.in/yaml.v2"; - fetch = { - type = "git"; - url = "https://gopkg.in/yaml.v2"; - rev = "eb3733d160e74a9c7e442f435eb3bea458e1d19f"; - sha256 = "1srhvcaa9db3a6xj29mkjr5kg33y71pclrlx4vcwz5m1lgb5c7q6"; - }; - } -]