2020-11-24 20:58:05 +00:00
|
|
|
{ buildGoModule
|
|
|
|
, fetchFromGitHub
|
2021-09-22 15:38:15 +00:00
|
|
|
, fetchurl
|
2022-10-21 18:38:19 +00:00
|
|
|
, fetchpatch
|
2020-11-24 20:58:05 +00:00
|
|
|
, go-bindata
|
|
|
|
, lib
|
|
|
|
, llvmPackages
|
2021-12-19 01:06:50 +00:00
|
|
|
, perl
|
2020-11-24 20:58:05 +00:00
|
|
|
, pkg-config
|
|
|
|
, rustPlatform
|
2021-05-20 23:08:51 +00:00
|
|
|
, stdenv
|
|
|
|
, libiconv
|
2020-11-24 20:58:05 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2022-11-21 17:40:18 +00:00
|
|
|
version = "2.5.1";
|
2022-10-06 18:32:54 +00:00
|
|
|
# Despite the name, this is not a rolling release. This is the
|
2022-11-21 17:40:18 +00:00
|
|
|
# version of the UI assets for 2.5.1, as specified in
|
|
|
|
# scripts/fetch-ui-assets.sh in the 2.5.1 tag of influxdb.
|
|
|
|
ui_version = "OSS-2022-09-16";
|
|
|
|
libflux_version = "0.188.1";
|
2020-11-24 20:58:05 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "influxdata";
|
|
|
|
repo = "influxdb";
|
|
|
|
rev = "v${version}";
|
2022-11-21 17:40:18 +00:00
|
|
|
sha256 = "sha256-AKyuFBja06BuWYliqIGKOb4PIc5G8S9S+cf/dLrEATY=";
|
2020-11-24 20:58:05 +00:00
|
|
|
};
|
|
|
|
|
2021-09-22 15:38:15 +00:00
|
|
|
ui = fetchurl {
|
2022-11-21 17:40:18 +00:00
|
|
|
url = "https://github.com/influxdata/ui/releases/download/${ui_version}/build.tar.gz";
|
2022-10-06 18:32:54 +00:00
|
|
|
sha256 = "sha256-YKDp1jLyo4n+YTeMaWl8dhN4Lr3H8FXV7stJ3p3zFe8=";
|
2020-11-24 20:58:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
flux = rustPlatform.buildRustPackage {
|
|
|
|
pname = "libflux";
|
|
|
|
version = "v${libflux_version}";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "influxdata";
|
|
|
|
repo = "flux";
|
|
|
|
rev = "v${libflux_version}";
|
2022-11-21 17:40:18 +00:00
|
|
|
sha256 = "sha256-Xmh7V/o1Gje62kcnTeB9h/fySljhfu+tjbyvryvIGRc=";
|
2020-11-24 20:58:05 +00:00
|
|
|
};
|
|
|
|
sourceRoot = "source/libflux";
|
2022-11-21 17:40:18 +00:00
|
|
|
cargoSha256 = "sha256-9rPW0lgi3lXJARa1KXgSY8LVJsoFjppok5ODGlqYeYw=";
|
2020-11-24 20:58:05 +00:00
|
|
|
nativeBuildInputs = [ llvmPackages.libclang ];
|
2021-05-20 23:08:51 +00:00
|
|
|
buildInputs = lib.optional stdenv.isDarwin libiconv;
|
|
|
|
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
|
2020-11-24 20:58:05 +00:00
|
|
|
pkgcfg = ''
|
|
|
|
Name: flux
|
|
|
|
Version: ${libflux_version}
|
|
|
|
Description: Library for the InfluxData Flux engine
|
|
|
|
Cflags: -I/out/include
|
|
|
|
Libs: -L/out/lib -lflux -ldl -lpthread
|
|
|
|
'';
|
|
|
|
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
|
2021-05-20 23:08:51 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
|
|
|
install_name_tool -id $out/lib/libflux.dylib $out/lib/libflux.dylib
|
2020-11-24 20:58:05 +00:00
|
|
|
'';
|
|
|
|
};
|
2021-12-19 01:06:50 +00:00
|
|
|
|
2020-11-24 20:58:05 +00:00
|
|
|
in buildGoModule {
|
|
|
|
pname = "influxdb";
|
|
|
|
version = version;
|
2022-11-21 17:40:18 +00:00
|
|
|
inherit src;
|
2020-11-24 20:58:05 +00:00
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
nativeBuildInputs = [ go-bindata pkg-config perl ];
|
2020-11-24 20:58:05 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
vendorSha256 = "sha256-02x+HsWkng7OnKVSfkQR8LL1Qk42Bdrw0IMtBpS7xQc=";
|
2021-12-19 01:06:50 +00:00
|
|
|
subPackages = [ "cmd/influxd" "cmd/telemetryd" ];
|
2020-11-24 20:58:05 +00:00
|
|
|
|
|
|
|
PKG_CONFIG_PATH = "${flux}/pkgconfig";
|
2022-10-21 18:38:19 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# use go-bindata from environment
|
|
|
|
substituteInPlace static/static.go \
|
|
|
|
--replace 'go run github.com/kevinburke/go-bindata/' ""
|
|
|
|
'';
|
|
|
|
|
2021-12-19 01:06:50 +00:00
|
|
|
# Check that libflux and the UI are at the right version, and embed
|
|
|
|
# the UI assets into the Go source tree.
|
2020-11-24 20:58:05 +00:00
|
|
|
preBuild = ''
|
2021-12-19 01:06:50 +00:00
|
|
|
(
|
|
|
|
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
|
2021-09-22 15:38:15 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
ui_ver=$(egrep 'UI_RELEASE=".*"' scripts/fetch-ui-assets.sh | cut -d'"' -f2)
|
2021-12-19 01:06:50 +00:00
|
|
|
if [ "$ui_ver" != "${ui_version}" ]; then
|
|
|
|
echo "scripts/fetch-ui-assets.sh wants UI $ui_ver, but nix derivation provides ${ui_version}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
)
|
|
|
|
|
|
|
|
mkdir -p static/data
|
|
|
|
tar -xzf ${ui} -C static/data
|
|
|
|
pushd static
|
|
|
|
go generate
|
|
|
|
popd
|
2020-11-24 20:58:05 +00:00
|
|
|
'';
|
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
tags = [ "assets" ];
|
|
|
|
|
2021-12-19 01:06:50 +00:00
|
|
|
ldflags = [ "-X main.commit=v${version}" "-X main.version=${version}" ];
|
2021-08-08 23:34:03 +00:00
|
|
|
|
2020-11-24 20:58:05 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "An open-source distributed time series database";
|
|
|
|
license = licenses.mit;
|
|
|
|
homepage = "https://influxdata.com/";
|
2021-12-19 01:06:50 +00:00
|
|
|
maintainers = with maintainers; [ abbradar danderson ];
|
2020-11-24 20:58:05 +00:00
|
|
|
};
|
|
|
|
}
|