2022-10-22 03:52:19 +00:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, stdenv, pkg-config, rustPlatform, llvmPackages, libiconv, fetchpatch, nixosTests }:
|
2015-11-16 11:59:30 +00:00
|
|
|
|
2022-10-19 08:17:28 +00:00
|
|
|
let
|
|
|
|
libflux_version = "0.170.1";
|
|
|
|
|
|
|
|
# This is copied from influxdb2 with flux version matching the needed by thi
|
|
|
|
flux = rustPlatform.buildRustPackage {
|
|
|
|
pname = "libflux";
|
|
|
|
version = "v${libflux_version}";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "influxdata";
|
|
|
|
repo = "flux";
|
|
|
|
rev = "v${libflux_version}";
|
|
|
|
sha256 = "sha256-P3SpleOVbL+nGWdscwjj9yWqRdck/9JsAwuJtGOO7N8=";
|
|
|
|
};
|
|
|
|
patches = [
|
|
|
|
# https://github.com/influxdata/flux/pull/5273
|
|
|
|
# fix compile error with Rust 1.64
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/influxdata/flux/commit/20ca62138a0669f2760dd469ca41fc333e04b8f2.patch";
|
|
|
|
stripLen = 2;
|
|
|
|
extraPrefix = "";
|
|
|
|
sha256 = "sha256-Fb4CuH9ZvrPha249dmLLI8MqSNQRKqKPxPbw2pjqwfY=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
sourceRoot = "source/libflux";
|
|
|
|
cargoSha256 = "sha256-kYiZ5ZRiFHRf1RQeeUGjIhnEkTvhNSZ0t4tidpRIDyk=";
|
|
|
|
nativeBuildInputs = [ llvmPackages.libclang ];
|
|
|
|
buildInputs = lib.optional stdenv.isDarwin libiconv;
|
|
|
|
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
|
|
|
|
pkgcfg = ''
|
|
|
|
Name: flux
|
|
|
|
Version: ${libflux_version}
|
|
|
|
Description: Library for the InfluxData Flux engine
|
|
|
|
Cflags: -I/out/include
|
2023-01-23 15:34:53 +00:00
|
|
|
Libs: -L/out/lib -lflux -lpthread
|
2022-10-19 08:17:28 +00:00
|
|
|
'';
|
|
|
|
passAsFile = [ "pkgcfg" ];
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/include $out/pkgconfig
|
|
|
|
cp -r $NIX_BUILD_TOP/source/libflux/include/influxdata $out/include
|
|
|
|
substitute $pkgcfgPath $out/pkgconfig/flux.pc \
|
|
|
|
--replace /out $out
|
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
|
|
|
install_name_tool -id $out/lib/libflux.dylib $out/lib/libflux.dylib
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in
|
2020-04-13 11:48:11 +00:00
|
|
|
buildGoModule rec {
|
2019-04-10 20:32:13 +00:00
|
|
|
pname = "influxdb";
|
2022-10-19 08:17:28 +00:00
|
|
|
version = "1.10.0";
|
2016-10-26 12:21:50 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "influxdata";
|
2019-04-10 20:32:13 +00:00
|
|
|
repo = pname;
|
2016-10-26 12:21:50 +00:00
|
|
|
rev = "v${version}";
|
2022-10-19 08:17:28 +00:00
|
|
|
sha256 = "sha256-BMHR9EdYC+8oA0he7emzBRmNnHn15nO/5NqsLcr+R0k=";
|
2016-10-26 12:21:50 +00:00
|
|
|
};
|
2016-06-12 13:38:11 +00:00
|
|
|
|
2022-10-19 08:17:28 +00:00
|
|
|
vendorSha256 = "sha256-AY04cmfg7vbrWR4+LBuCFYqBgQJBXlPpO+2oj0qqjM4=";
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
|
|
|
|
|
|
PKG_CONFIG_PATH = "${flux}/pkgconfig";
|
|
|
|
|
|
|
|
# Check that libflux is at the right version
|
|
|
|
preBuild = ''
|
|
|
|
flux_ver=$(grep github.com/influxdata/flux go.mod | awk '{print $2}')
|
|
|
|
if [ "$flux_ver" != "v${libflux_version}" ]; then
|
|
|
|
echo "go.mod wants libflux $flux_ver, but nix derivation provides ${libflux_version}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
'';
|
2017-11-25 02:45:49 +00:00
|
|
|
|
2020-08-04 00:26:27 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
2021-08-26 06:45:51 +00:00
|
|
|
ldflags = [ "-s" "-w" "-X main.version=${version}" ];
|
2015-11-16 11:59:30 +00:00
|
|
|
|
|
|
|
excludedPackages = "test";
|
2014-05-26 09:12:38 +00:00
|
|
|
|
2022-10-22 03:52:19 +00:00
|
|
|
passthru.tests = { inherit (nixosTests) influxdb; };
|
|
|
|
|
2015-11-16 11:59:30 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "An open-source distributed time series database";
|
2014-05-26 09:12:38 +00:00
|
|
|
license = licenses.mit;
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://influxdata.com/";
|
2016-06-12 13:38:11 +00:00
|
|
|
maintainers = with maintainers; [ offline zimbatm ];
|
2014-05-26 09:12:38 +00:00
|
|
|
};
|
2020-07-31 03:58:04 +00:00
|
|
|
}
|