Unverified Commit 5b754654 authored by Franz Pletz's avatar Franz Pletz Committed by GitHub
Browse files

mirrorbits: 0.5.1 -> 0.6 (#405424)

parents d91d7cf3 1a5ed277
Loading
Loading
Loading
Loading
+20 −18
Original line number Diff line number Diff line
{
  lib,
  versionCheckHook,
  buildGoModule,
  fetchFromGitHub,
  fetchpatch,
  pkg-config,
  zlib,
  geoip,
}:

buildGoModule rec {
buildGoModule (finalAttrs: {
  pname = "mirrorbits";
  version = "0.5.1";
  version = "0.6";

  src = fetchFromGitHub {
    owner = "etix";
    repo = "mirrorbits";
    rev = "v${version}";
    hash = "sha256-Ta3+Y3P74cvx09Z4rB5ObgBZtfF4grVgyeZ57yFPlGM=";
    tag = "v${finalAttrs.version}";
    hash = "sha256-99eOfVSlGIEzNm+0gI/y0+UPd+dnZiGzaHlkqUNtO1U=";
  };

  vendorHash = null;
  postPatch = ''
    rm -rf vendor
  '';

  patches = [
    # Add Go Modules support
    (fetchpatch {
      url = "https://github.com/etix/mirrorbits/commit/955a8b2e1aacea1cae06396a64afbb531ceb36d4.patch";
      hash = "sha256-KJgj3ynnjjiXG5qsUmzBiMjGEwfvM/9Ap+ZgUdhclik=";
    })
  ];
  vendorHash = "sha256-cdD9RvOtgN/SHtgrtrucnUI+nnO/FabUyPRdvgoL44o=";

  nativeBuildInputs = [ pkg-config ];

  buildInputs = [
    zlib
    geoip
@@ -40,10 +37,15 @@ buildGoModule rec {
  ldflags = [
    "-s"
    "-w"
    "-X github.com/etix/mirrorbits/core.VERSION=${finalAttrs.version}"
  ];

  meta = with lib; {
    description = "geographical download redirector for distributing files efficiently across a set of mirrors";
  doInstallCheck = true;
  nativeInstallCheckInputs = [ versionCheckHook ];
  versionCheckProgramArg = "version";

  meta = {
    description = "Geographical download redirector for distributing files efficiently across a set of mirrors";
    homepage = "https://github.com/etix/mirrorbits";
    longDescription = ''
      Mirrorbits is a geographical download redirector written in Go for
@@ -53,8 +55,8 @@ buildGoModule rec {
      the distribution of large-scale Open-Source projects with a lot
      of traffic.
    '';
    license = licenses.mit;
    maintainers = with maintainers; [ fpletz ];
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ fpletz ];
    mainProgram = "mirrorbits";
  };
}
})