Merge pull request #259152 from totoroot/update/kapacitor-unstable-2023-08-18

authored by Janik and committed by GitHub c2ff411c bb6be0ba

+79 -9
+79 -9
pkgs/servers/monitoring/kapacitor/default.nix
··· 1 - { lib, fetchFromGitHub, buildGoPackage }: 1 + { stdenv 2 + , lib 3 + , rustPlatform 4 + , fetchFromGitHub 5 + , fetchpatch 6 + , libiconv 7 + , buildGoModule 8 + , pkg-config 9 + }: 2 10 3 - buildGoPackage rec { 11 + let 12 + libflux_version = "0.171.0"; 13 + flux = rustPlatform.buildRustPackage rec { 14 + pname = "libflux"; 15 + version = "v${libflux_version}"; 16 + src = fetchFromGitHub { 17 + owner = "influxdata"; 18 + repo = "flux"; 19 + rev = "v${libflux_version}"; 20 + hash = "sha256-v9MUR+PcxAus91FiHYrMN9MbNOTWewh7MT6/t/QWQcM="; 21 + }; 22 + patches = [ 23 + # https://github.com/influxdata/flux/pull/5273 24 + # fix compile error with Rust 1.64 25 + (fetchpatch { 26 + url = "https://github.com/influxdata/flux/commit/20ca62138a0669f2760dd469ca41fc333e04b8f2.patch"; 27 + stripLen = 2; 28 + extraPrefix = ""; 29 + hash = "sha256-Fb4CuH9ZvrPha249dmLLI8MqSNQRKqKPxPbw2pjqwfY="; 30 + }) 31 + ]; 32 + sourceRoot = "${src.name}/libflux"; 33 + cargoSha256 = "sha256-oAMoGGdR0QEjSzZ0/J5J9s/ekSlryCcRBSo5N2r70Ko="; 34 + nativeBuildInputs = [ rustPlatform.bindgenHook ]; 35 + buildInputs = lib.optional stdenv.isDarwin libiconv; 36 + pkgcfg = '' 37 + Name: flux 38 + Version: ${libflux_version} 39 + Description: Library for the InfluxData Flux engine 40 + Cflags: -I/out/include 41 + Libs: -L/out/lib -lflux -lpthread 42 + ''; 43 + passAsFile = [ "pkgcfg" ]; 44 + postInstall = '' 45 + mkdir -p $out/include $out/pkgconfig 46 + cp -r $NIX_BUILD_TOP/source/libflux/include/influxdata $out/include 47 + substitute $pkgcfgPath $out/pkgconfig/flux.pc \ 48 + --replace /out $out 49 + '' + lib.optionalString stdenv.isDarwin '' 50 + install_name_tool -id $out/lib/libflux.dylib $out/lib/libflux.dylib 51 + ''; 52 + }; 53 + in 54 + buildGoModule rec { 4 55 pname = "kapacitor"; 5 - version = "1.5.7"; 6 - 7 - goPackagePath = "github.com/influxdata/kapacitor"; 56 + version = "1.7.0"; 8 57 9 58 src = fetchFromGitHub { 10 59 owner = "influxdata"; 11 60 repo = "kapacitor"; 12 61 rev = "v${version}"; 13 - sha256 = "0lzx25d4y5d8rsddgnypfskcxa5qlwc294sdzmn8dlq995yphpac"; 62 + hash = "sha256-vDluZZrct1x+OMVU8MNO56YBZq7JNlpW68alOrAGYSM="; 14 63 }; 15 64 65 + vendorHash = "sha256-OX4QAthg15lwMyhOPyLTS++CMvGI5Um+FSd025PhW3E="; 66 + 67 + nativeBuildInputs = [ pkg-config ]; 68 + 69 + PKG_CONFIG_PATH = "${flux}/pkgconfig"; 70 + 71 + # Check that libflux is at the right version 72 + preBuild = '' 73 + flux_ver=$(grep github.com/influxdata/flux go.mod | awk '{print $2}') 74 + if [ "$flux_ver" != "v${libflux_version}" ]; then 75 + echo "go.mod wants libflux $flux_ver, but nix derivation provides ${libflux_version}" 76 + exit 1 77 + fi 78 + ''; 79 + 80 + # Remove failing server tests 81 + preCheck = '' 82 + rm server/server_test.go 83 + ''; 84 + 16 85 meta = with lib; { 17 86 description = "Open source framework for processing, monitoring, and alerting on time series data"; 87 + homepage = "https://influxdata.com/time-series-platform/kapacitor/"; 88 + downloadPage = "https://github.com/influxdata/kapacitor/releases"; 18 89 license = licenses.mit; 19 - homepage = "https://influxdata.com/time-series-platform/kapacitor/"; 20 - maintainers = with maintainers; [ offline ]; 21 - platforms = with platforms; linux; 90 + changelog = "https://github.com/influxdata/kapacitor/blob/master/CHANGELOG.md"; 91 + maintainers = with maintainers; [ offline totoroot ]; 22 92 }; 23 93 }