gitaly: fix build with >=18.3

This fixes build issues with gitaly >=18.3.
This change authored by Helsinki Systems. Thank you for providing this.

Changed files
+68 -15
pkgs
by-name
gi
gitaly
gitlab-pages
+39 -13
pkgs/by-name/gi/gitaly/git.nix
···
curl,
pcre2,
zlib,
+
git,
+
pkg-config,
+
openssl,
}:
stdenv.mkDerivation rec {
···
owner = "gitlab-org";
repo = "git";
rev = "v${version}";
-
hash = "sha256-1y94T5UBG7s76ENsUmaXRXngSKmqIAT0nq1u+QjSWaY=";
+
hash = "sha256-VFqUz79RvkOE4CS8GUZTPhah2AbvrlyHr4iYhWqh61Y=";
+
leaveDotGit = true;
+
# The build system clones the repo from the store (since it always expects
+
# to be able to clone in the makefiles) and it looks like nix doesn't leave
+
# the tag so we re-add it.
+
postFetch = ''
+
git -C $out tag v${version};
+
'';
};
-
# we actually use the gitaly build system
+
# Use gitaly and their build system as source root
unpackPhase = ''
cp -r ${gitaly.src} source
chmod -R +w source
+
git config --global --add safe.directory '*'
+
'';
-
mkdir -p source/_build/deps
-
-
cp -r ${src} source/_build/deps/git-distribution
-
chmod -R +w source/_build/deps/git-distribution
-
-
# FIXME? maybe just patch the makefile?
-
echo -n 'v${version} DEVELOPER=1 DEVOPTS=no-error USE_LIBPCRE=YesPlease NO_PERL=YesPlease NO_EXPAT=YesPlease NO_TCLTK=YesPlease NO_GETTEXT=YesPlease NO_PYTHON=YesPlease' > source/_build/deps/git-distribution.version
-
echo -n 'v${version}' > source/_build/deps/git-distribution/version
-
'';
sourceRoot = src.name;
buildFlags = [ "git" ];
+
GIT_REPO_URL = src;
+
HOME = "/build";
+
nativeBuildInputs = [
+
git # clones our repo from the store
+
pkg-config
+
];
+
# git inputs
buildInputs = [
-
curl
+
openssl
+
zlib
pcre2
-
zlib
+
curl
];
+
# required to support pthread_cancel()
+
NIX_LDFLAGS =
+
lib.optionalString (stdenv.cc.isGNU && stdenv.hostPlatform.libc == "glibc") "-lgcc_s"
+
+ lib.optionalString stdenv.isFreeBSD "-lthr";
+
# The build phase already installs it all
GIT_PREFIX = placeholder "out";
dontInstall = true;
+
+
doInstallCheck = true;
+
installCheckPhase = ''
+
runHook preInstallCheck
+
+
HOME=/build PAGER=cat $out/bin/git config -l
+
file $out/bin/git | grep -qv 'too large section header'
+
+
runHook postInstallCheck
+
'';
meta = {
homepage = "https://git-scm.com/";
+24 -2
pkgs/by-name/gi/gitaly/package.nix
···
tags = [ "static" ];
+
nativeBuildInputs = [ pkg-config ];
+
doCheck = false;
};
···
pname = "gitaly-aux";
subPackages = [
+
# Can be determined by looking at the `go:embed` calls in https://gitlab.com/gitlab-org/gitaly/-/blob/master/packed_binaries.go
"cmd/gitaly-hooks"
"cmd/gitaly-ssh"
"cmd/gitaly-lfs-smudge"
···
"cmd/gitaly-backup"
];
+
dontStrip = true;
+
preConfigure = ''
+
rm -r tools
+
mkdir -p _build/bin
cp -r ${auxBins}/bin/* _build/bin
-
for f in ${git}/bin/git-*; do
-
cp "$f" "_build/bin/gitaly-$(basename $f)";
+
+
# Add git that will be embedded
+
echo 'print-%:;@echo $($*)' >> Makefile
+
sed -i 's:/usr/bin/env ::g' Makefile
+
for bin in $(make print-GIT_PACKED_EXECUTABLES); do
+
from="$(basename "$bin")"
+
from="''${from#gitaly-}"
+
from="${git}/libexec/git-core/''${from%-*}"
+
cp "$from" "$bin"
done
+
+
'';
+
+
doInstallCheck = true;
+
installCheckPhase = ''
+
runHook preInstallCheck
+
HOME=/build PAGER=cat ${git}/bin/git config -l
+
runHook postInstallCheck
'';
outputs = [ "out" ];
+5
pkgs/by-name/gi/gitlab-pages/package.nix
···
vendorHash = "sha256-OubXCpvGtGqegQmdb6R1zw/0DfQ4FdbJGt7qYYRnWnA=";
subPackages = [ "." ];
+
ldflags = [
+
"-X"
+
"main.VERSION=${version}"
+
];
+
meta = {
description = "Daemon used to serve static websites for GitLab users";
mainProgram = "gitlab-pages";