nixpkgs/pkgs/servers/sql/cockroachdb/default.nix

64 lines
1.6 KiB
Nix
Raw Normal View History

{ stdenv, buildGoPackage, fetchurl
, cmake, xz, which, autoconf
, ncurses6, libedit, libunwind
2020-04-26 04:16:55 +01:00
, installShellFiles
}:
2016-09-20 12:31:54 +01: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 ];
in
2016-09-20 12:31:54 +01:00
buildGoPackage rec {
pname = "cockroach";
2020-07-01 03:38:44 +01:00
version = "20.1.2";
2016-09-20 12:31:54 +01:00
goPackagePath = "github.com/cockroachdb/cockroach";
2016-09-30 21:46:42 +01:00
src = fetchurl {
url = "https://binaries.cockroachdb.com/cockroach-v${version}.src.tgz";
2020-07-01 03:38:44 +01:00
sha256 = "1xmb516xr0bhkzj6yigcrxbghvh0dis85dq7n5hi49mn951ad5yn";
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
inherit nativeBuildInputs buildInputs;
2016-09-20 18:02:26 +01:00
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
install -D cockroachoss $out/bin/cockroach
2020-04-26 04:16:55 +01:00
installShellCompletion cockroach.bash
mkdir -p $man/share/man
cp -r man $man/share/man
runHook postInstall
'';
2016-09-20 12:31:54 +01:00
outputs = [ "out" "man" ];
2016-09-20 12:31:54 +01:00
meta = with stdenv.lib; {
homepage = "https://www.cockroachlabs.com";
2016-09-20 12:31:54 +01:00
description = "A scalable, survivable, strongly-consistent SQL database";
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
};
}