2018-11-29 18:49:40 +00:00
|
|
|
{ stdenv, buildGoPackage, fetchurl
|
|
|
|
, cmake, xz, which, autoconf
|
|
|
|
, ncurses6, libedit, libunwind
|
|
|
|
}:
|
2016-09-20 12:31:54 +01:00
|
|
|
|
2018-11-29 18:49:40 +00:00
|
|
|
let
|
|
|
|
darwinDeps = [ libunwind libedit ];
|
|
|
|
linuxDeps = [ ncurses6 ];
|
|
|
|
|
|
|
|
buildInputs = if stdenv.isDarwin then darwinDeps else linuxDeps;
|
|
|
|
nativeBuildInputs = [ cmake xz which autoconf ];
|
|
|
|
|
|
|
|
in
|
2016-09-20 12:31:54 +01:00
|
|
|
buildGoPackage rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "cockroach";
|
2019-06-03 11:54:31 +01:00
|
|
|
version = "19.1.1";
|
2016-09-20 12:31:54 +01:00
|
|
|
|
|
|
|
goPackagePath = "github.com/cockroachdb/cockroach";
|
|
|
|
|
2016-09-30 21:46:42 +01:00
|
|
|
src = fetchurl {
|
2017-10-25 09:11:16 +01:00
|
|
|
url = "https://binaries.cockroachdb.com/cockroach-v${version}.src.tgz";
|
2019-06-03 11:54:31 +01:00
|
|
|
sha256 = "1vbz5j0y9ri8c99k8fc5rnwigay478p1mac5g402639ilkqd41fc";
|
2016-09-20 12:31:54 +01:00
|
|
|
};
|
|
|
|
|
2018-11-29 18:49:40 +00:00
|
|
|
inherit nativeBuildInputs buildInputs;
|
2016-09-20 18:02:26 +01:00
|
|
|
|
2017-10-25 09:11:16 +01:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
cd $NIX_BUILD_TOP/go/src/${goPackagePath}
|
|
|
|
patchShebangs .
|
|
|
|
make buildoss
|
|
|
|
cd src/${goPackagePath}
|
|
|
|
for asset in man autocomplete; do
|
2018-11-29 18:49:40 +00:00
|
|
|
./cockroachoss gen $asset
|
2017-10-25 09:11:16 +01:00
|
|
|
done
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2018-11-29 18:49:40 +00:00
|
|
|
|
|
|
|
install -D cockroachoss $bin/bin/cockroach
|
2017-10-25 09:11:16 +01:00
|
|
|
install -D cockroach.bash $bin/share/bash-completion/completions/cockroach.bash
|
2018-11-29 18:49:40 +00:00
|
|
|
|
|
|
|
mkdir -p $man/share/man
|
|
|
|
cp -r man $man/share/man
|
|
|
|
|
2017-10-25 09:11:16 +01:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
2016-09-20 12:31:54 +01:00
|
|
|
|
2018-11-29 18:49:40 +00:00
|
|
|
# Unfortunately we have to keep an empty reference to $out, because it seems
|
|
|
|
# buildGoPackages only nukes references to the go compiler under $bin, effectively
|
|
|
|
# making all binary output under $bin mandatory. Ideally, we would just use
|
|
|
|
# $out and $man and remove $bin since there's no point in an empty path. :(
|
|
|
|
outputs = [ "bin" "man" "out" ];
|
|
|
|
|
2016-09-20 12:31:54 +01:00
|
|
|
meta = with stdenv.lib; {
|
2018-11-29 18:49:40 +00:00
|
|
|
homepage = https://www.cockroachlabs.com;
|
2016-09-20 12:31:54 +01:00
|
|
|
description = "A scalable, survivable, strongly-consistent SQL database";
|
2018-11-29 18:49:40 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
|
2019-06-03 11:54:31 +01:00
|
|
|
maintainers = with maintainers; [ rushmorem thoughtpolice rvolosatovs ];
|
2016-09-20 12:31:54 +01:00
|
|
|
};
|
|
|
|
}
|