at 23.05-pre 70 lines 1.9 kB view raw
1{ lib, stdenv, buildGoPackage, fetchurl 2, cmake, xz, which, autoconf 3, ncurses6, libedit, libunwind 4, installShellFiles 5, removeReferencesTo, go 6}: 7 8let 9 darwinDeps = [ libunwind libedit ]; 10 linuxDeps = [ ncurses6 ]; 11 12 buildInputs = if stdenv.isDarwin then darwinDeps else linuxDeps; 13 nativeBuildInputs = [ installShellFiles cmake xz which autoconf ]; 14 15in 16buildGoPackage rec { 17 pname = "cockroach"; 18 version = "20.1.8"; 19 20 goPackagePath = "github.com/cockroachdb/cockroach"; 21 22 src = fetchurl { 23 url = "https://binaries.cockroachdb.com/cockroach-v${version}.src.tgz"; 24 sha256 = "0mm3hfr778c7djza8gr1clwa8wca4d3ldh9hlg80avw4x664y5zi"; 25 }; 26 27 NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [ "-Wno-error=deprecated-copy" "-Wno-error=redundant-move" "-Wno-error=pessimizing-move" ]; 28 29 inherit nativeBuildInputs buildInputs; 30 31 buildPhase = '' 32 runHook preBuild 33 cd $NIX_BUILD_TOP/go/src/${goPackagePath} 34 patchShebangs . 35 make buildoss 36 cd src/${goPackagePath} 37 for asset in man autocomplete; do 38 ./cockroachoss gen $asset 39 done 40 runHook postBuild 41 ''; 42 43 installPhase = '' 44 runHook preInstall 45 46 install -D cockroachoss $out/bin/cockroach 47 installShellCompletion cockroach.bash 48 49 mkdir -p $man/share/man 50 cp -r man $man/share/man 51 52 runHook postInstall 53 ''; 54 55 outputs = [ "out" "man" ]; 56 57 # fails with `GOFLAGS=-trimpath` 58 allowGoReference = true; 59 preFixup = '' 60 find $out -type f -exec ${removeReferencesTo}/bin/remove-references-to -t ${go} '{}' + 61 ''; 62 63 meta = with lib; { 64 homepage = "https://www.cockroachlabs.com"; 65 description = "A scalable, survivable, strongly-consistent SQL database"; 66 license = licenses.bsl11; 67 platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ]; 68 maintainers = with maintainers; [ rushmorem thoughtpolice ]; 69 }; 70}