depot/third_party/nixpkgs/pkgs/applications/version-management/gitlab/gitaly/default.nix
Default email 14910f5943 Project import generated by Copybara.
GitOrigin-RevId: 5aaed40d22f0d9376330b6fa413223435ad6fee5
2022-01-13 15:06:32 -05:00

79 lines
2.3 KiB
Nix

{ lib, fetchFromGitLab, fetchFromGitHub, buildGoModule, ruby
, bundlerEnv, pkg-config
# libgit2 + dependencies
, libgit2, openssl, zlib, pcre, http-parser }:
let
# git2go 32.0.5 does not support libgit2 1.2.0 or 1.3.0.
# It needs a specific commit in between those two releases.
libgit2_custom = libgit2.overrideAttrs (oldAttrs: rec {
version = "1.2.0";
src = fetchFromGitHub {
owner = "libgit2";
repo = "libgit2";
rev = "109b4c887ffb63962c7017a66fc4a1f48becb48e";
sha256 = "sha256-w029FHpOv5K49wE1OJMOlkTe+2cv+ORYqEHxs59GDBI=";
};
});
rubyEnv = bundlerEnv rec {
name = "gitaly-env";
inherit ruby;
copyGemFiles = true;
gemdir = ./.;
gemset =
let x = import (gemdir + "/gemset.nix");
in x // {
# grpc expects the AR environment variable to contain `ar rpc`. See the
# discussion in nixpkgs #63056.
grpc = x.grpc // {
patches = [ ../fix-grpc-ar.patch ];
dontBuild = false;
};
};
};
version = "14.6.1";
gitaly_package = "gitlab.com/gitlab-org/gitaly/v${lib.versions.major version}";
in
buildGoModule {
pname = "gitaly";
inherit version;
src = fetchFromGitLab {
owner = "gitlab-org";
repo = "gitaly";
rev = "v${version}";
sha256 = "sha256-nbE71s+KoDC6EK26cmq+YIw9MFSQv1y6qwZAJXVXGj4=";
};
vendorSha256 = "sha256-ZLd4E3+e25Hqmd6ZyF3X6BveMEg7OF0FX9IvNBWn3v0=";
passthru = {
inherit rubyEnv;
};
ldflags = "-X ${gitaly_package}/internal/version.version=${version} -X ${gitaly_package}/internal/version.moduleVersion=${version}";
tags = [ "static,system_libgit2" ];
nativeBuildInputs = [ pkg-config ];
buildInputs = [ rubyEnv.wrappedRuby libgit2_custom openssl zlib pcre http-parser ];
doCheck = false;
postInstall = ''
mkdir -p $ruby
cp -rv $src/ruby/{bin,lib,proto,git-hooks} $ruby
mv $out/bin/gitaly-git2go $out/bin/gitaly-git2go-${version}
'';
outputs = [ "out" "ruby" ];
meta = with lib; {
homepage = "https://gitlab.com/gitlab-org/gitaly";
description = "A Git RPC service for handling all the git calls made by GitLab";
platforms = platforms.linux ++ [ "x86_64-darwin" ];
maintainers = with maintainers; [ roblabla globin fpletz talyz ];
license = licenses.mit;
};
}