2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, buildGoPackage, fetchurl
|
2018-11-29 18:49:40 +00:00
|
|
|
, cmake, xz, which, autoconf
|
|
|
|
, ncurses6, libedit, libunwind
|
2020-04-26 04:16:55 +01:00
|
|
|
, installShellFiles
|
2020-11-02 05:24:25 +00:00
|
|
|
, removeReferencesTo, go
|
2018-11-29 18:49:40 +00:00
|
|
|
}:
|
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;
|
2020-04-26 04:16:55 +01:00
|
|
|
nativeBuildInputs = [ installShellFiles cmake xz which autoconf ];
|
2018-11-29 18:49:40 +00:00
|
|
|
|
|
|
|
in
|
2016-09-20 12:31:54 +01:00
|
|
|
buildGoPackage rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "cockroach";
|
2020-11-12 17:28:52 +00:00
|
|
|
version = "20.1.8";
|
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";
|
2020-11-12 17:28:52 +00:00
|
|
|
sha256 = "0mm3hfr778c7djza8gr1clwa8wca4d3ldh9hlg80avw4x664y5zi";
|
2016-09-20 12:31:54 +01:00
|
|
|
};
|
|
|
|
|
2019-12-27 04:08:03 +00:00
|
|
|
NIX_CFLAGS_COMPILE = stdenv.lib.optionals stdenv.cc.isGNU [ "-Wno-error=deprecated-copy" "-Wno-error=redundant-move" "-Wno-error=pessimizing-move" ];
|
2019-11-03 13:09:10 +00: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
|
|
|
|
2020-04-28 02:50:57 +01:00
|
|
|
install -D cockroachoss $out/bin/cockroach
|
2020-04-26 04:16:55 +01:00
|
|
|
installShellCompletion 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
|
|
|
|
2020-04-28 02:50:57 +01:00
|
|
|
outputs = [ "out" "man" ];
|
2018-11-29 18:49:40 +00:00
|
|
|
|
2020-11-02 05:24:25 +00:00
|
|
|
# fails with `GOFLAGS=-trimpath`
|
|
|
|
allowGoReference = true;
|
|
|
|
preFixup = ''
|
|
|
|
find $out -type f -exec ${removeReferencesTo}/bin/remove-references-to -t ${go} '{}' +
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://www.cockroachlabs.com";
|
2016-09-20 12:31:54 +01:00
|
|
|
description = "A scalable, survivable, strongly-consistent SQL database";
|
2020-05-24 19:46:13 +01:00
|
|
|
license = licenses.bsl11;
|
2018-11-29 18:49:40 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
}
|