2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv, buildGoPackage, fetchurl
|
|
|
|
, cmake, xz, which, autoconf
|
|
|
|
, ncurses6, libedit, libunwind
|
2020-05-03 17:38:23 +00:00
|
|
|
, installShellFiles
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
darwinDeps = [ libunwind libedit ];
|
|
|
|
linuxDeps = [ ncurses6 ];
|
|
|
|
|
|
|
|
buildInputs = if stdenv.isDarwin then darwinDeps else linuxDeps;
|
2020-05-03 17:38:23 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles cmake xz which autoconf ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
in
|
|
|
|
buildGoPackage rec {
|
|
|
|
pname = "cockroach";
|
|
|
|
version = "19.1.5";
|
|
|
|
|
|
|
|
goPackagePath = "github.com/cockroachdb/cockroach";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://binaries.cockroachdb.com/cockroach-v${version}.src.tgz";
|
|
|
|
sha256 = "1pnzzmxxb7qxiiy8qpl2sifk4qrijjbhmzy47bnjj5ssdsjjjcqy";
|
|
|
|
};
|
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE = stdenv.lib.optionals stdenv.cc.isGNU [ "-Wno-error=deprecated-copy" "-Wno-error=redundant-move" "-Wno-error=pessimizing-move" ];
|
|
|
|
|
|
|
|
inherit nativeBuildInputs buildInputs;
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
cd $NIX_BUILD_TOP/go/src/${goPackagePath}
|
|
|
|
patchShebangs .
|
|
|
|
make buildoss
|
|
|
|
cd src/${goPackagePath}
|
|
|
|
for asset in man autocomplete; do
|
|
|
|
./cockroachoss gen $asset
|
|
|
|
done
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
install -D cockroachoss $out/bin/cockroach
|
2020-05-03 17:38:23 +00:00
|
|
|
installShellCompletion cockroach.bash
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
mkdir -p $man/share/man
|
|
|
|
cp -r man $man/share/man
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
outputs = [ "out" "man" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = "https://www.cockroachlabs.com";
|
|
|
|
description = "A scalable, survivable, strongly-consistent SQL database";
|
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
|
|
|
|
maintainers = with maintainers; [ rushmorem thoughtpolice rvolosatovs ];
|
|
|
|
};
|
|
|
|
}
|