a4fd2de975
GitOrigin-RevId: 34ad166a830d3ac1541dcce571c52231f2f0865a
63 lines
1.6 KiB
Nix
63 lines
1.6 KiB
Nix
{ stdenv, buildGoPackage, fetchurl
|
|
, cmake, xz, which, autoconf
|
|
, ncurses6, libedit, libunwind
|
|
, installShellFiles
|
|
}:
|
|
|
|
let
|
|
darwinDeps = [ libunwind libedit ];
|
|
linuxDeps = [ ncurses6 ];
|
|
|
|
buildInputs = if stdenv.isDarwin then darwinDeps else linuxDeps;
|
|
nativeBuildInputs = [ installShellFiles cmake xz which autoconf ];
|
|
|
|
in
|
|
buildGoPackage rec {
|
|
pname = "cockroach";
|
|
version = "20.1.7";
|
|
|
|
goPackagePath = "github.com/cockroachdb/cockroach";
|
|
|
|
src = fetchurl {
|
|
url = "https://binaries.cockroachdb.com/cockroach-v${version}.src.tgz";
|
|
sha256 = "1m1jziby0mzfbpwsak1marh1k9sx8vhc17ix6lgikxip4dpf52qg";
|
|
};
|
|
|
|
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
|
|
|
|
install -D cockroachoss $out/bin/cockroach
|
|
installShellCompletion cockroach.bash
|
|
|
|
mkdir -p $man/share/man
|
|
cp -r man $man/share/man
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
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 ];
|
|
};
|
|
}
|