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

71 lines
1.8 KiB
Nix
Raw Normal View History

{ lib, stdenv, buildGoPackage, fetchurl
, cmake, xz, which, autoconf
, ncurses6, libedit, libunwind
2020-04-26 03:16:55 +00:00
, installShellFiles
, removeReferencesTo, go
}:
2016-09-20 11:31:54 +00:00
let
darwinDeps = [ libunwind libedit ];
linuxDeps = [ ncurses6 ];
buildInputs = if stdenv.isDarwin then darwinDeps else linuxDeps;
2020-04-26 03:16:55 +00:00
nativeBuildInputs = [ installShellFiles cmake xz which autoconf ];
in
2016-09-20 11:31:54 +00:00
buildGoPackage rec {
pname = "cockroach";
2020-11-12 17:28:52 +00:00
version = "20.1.8";
2016-09-20 11:31:54 +00:00
goPackagePath = "github.com/cockroachdb/cockroach";
2016-09-30 20:46:42 +00:00
src = fetchurl {
url = "https://binaries.cockroachdb.com/cockroach-v${version}.src.tgz";
2020-11-12 17:28:52 +00:00
sha256 = "0mm3hfr778c7djza8gr1clwa8wca4d3ldh9hlg80avw4x664y5zi";
2016-09-20 11:31:54 +00:00
};
2021-01-15 07:07:56 +00:00
NIX_CFLAGS_COMPILE = 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 17:02:26 +00: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 03:16:55 +00:00
installShellCompletion cockroach.bash
mkdir -p $man/share/man
cp -r man $man/share/man
runHook postInstall
'';
2016-09-20 11:31:54 +00:00
outputs = [ "out" "man" ];
# fails with `GOFLAGS=-trimpath`
allowGoReference = true;
preFixup = ''
find $out -type f -exec ${removeReferencesTo}/bin/remove-references-to -t ${go} '{}' +
'';
meta = with lib; {
homepage = "https://www.cockroachlabs.com";
2016-09-20 11:31:54 +00:00
description = "A scalable, survivable, strongly-consistent SQL database";
2020-05-24 18:46:13 +00:00
license = licenses.bsl11;
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
2019-06-03 10:54:31 +00:00
maintainers = with maintainers; [ rushmorem thoughtpolice rvolosatovs ];
2016-09-20 11:31:54 +00:00
};
}