2020-11-24 20:58:05 +00:00
|
|
|
{ buildGoModule
|
|
|
|
, buildGoPackage
|
|
|
|
, fetchFromGitHub
|
2021-09-22 15:38:15 +00:00
|
|
|
, fetchurl
|
2020-11-24 20:58:05 +00:00
|
|
|
, go-bindata
|
|
|
|
, lib
|
|
|
|
, llvmPackages
|
|
|
|
, pkg-config
|
|
|
|
, rustPlatform
|
2021-05-20 23:08:51 +00:00
|
|
|
, stdenv
|
|
|
|
, libiconv
|
2020-11-24 20:58:05 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
# Note for maintainers: use ./update-influxdb2.sh to update the Yarn
|
|
|
|
# dependencies nix expression.
|
|
|
|
|
|
|
|
let
|
2021-09-22 15:38:15 +00:00
|
|
|
version = "2.0.8";
|
|
|
|
shorthash = "e91d41810f"; # git rev-parse HEAD with 2.0.8 checked out
|
|
|
|
libflux_version = "0.124.0";
|
2020-11-24 20:58:05 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "influxdata";
|
|
|
|
repo = "influxdb";
|
|
|
|
rev = "v${version}";
|
2021-09-22 15:38:15 +00:00
|
|
|
sha256 = "0hbinnja13xr9ziyynjsnsbrxmyrvag7xdgfwq2ya28g07lw5wgq";
|
2020-11-24 20:58:05 +00:00
|
|
|
};
|
|
|
|
|
2021-09-22 15:38:15 +00:00
|
|
|
ui = fetchurl {
|
|
|
|
url = "https://github.com/influxdata/ui/releases/download/OSS-v${version}/build.tar.gz";
|
|
|
|
# https://github.com/influxdata/ui/releases/download/OSS-v${version}/sha256.txt
|
|
|
|
sha256 = "94965ae999a1098c26128141fbb849be3da9a723d509118eb6e0db4384ee01fc";
|
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}";
|
2021-09-22 15:38:15 +00:00
|
|
|
sha256 = "1g1qilfzxqbbjbfvgkf7k7spcnhzvlmrqacpqdl05418ywkp3v29";
|
2020-11-24 20:58:05 +00:00
|
|
|
};
|
|
|
|
sourceRoot = "source/libflux";
|
2021-09-22 15:38:15 +00:00
|
|
|
cargoSha256 = "0farcjwnwwgfvcgbs5r6vsdrsiwq2mp82sjxkqb1pzqfls4ixcxj";
|
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
|
|
|
'';
|
|
|
|
};
|
|
|
|
in buildGoModule {
|
|
|
|
pname = "influxdb";
|
|
|
|
version = version;
|
|
|
|
src = src;
|
|
|
|
|
2021-02-13 14:23:35 +00:00
|
|
|
nativeBuildInputs = [ go-bindata pkg-config ];
|
2020-11-24 20:58:05 +00:00
|
|
|
|
2021-09-22 15:38:15 +00:00
|
|
|
vendorSha256 = "1kar88vlm6px7smlnajpyf8qx6d481xk979qafpfb1xy8931781m";
|
2020-11-24 20:58:05 +00:00
|
|
|
subPackages = [ "cmd/influxd" "cmd/influx" ];
|
|
|
|
|
|
|
|
PKG_CONFIG_PATH = "${flux}/pkgconfig";
|
|
|
|
# We have to run a bunch of go:generate commands to embed the UI
|
|
|
|
# assets into the source code. Ideally we'd run `make generate`, but
|
|
|
|
# that ends up running a ton of non-hermetic stuff. Instead, we find
|
|
|
|
# the relevant go:generate directives, and run them by hand without
|
|
|
|
# breaking hermeticity.
|
|
|
|
preBuild = ''
|
2021-09-22 15:38:15 +00:00
|
|
|
tar -xzf ${ui} -C static/data
|
|
|
|
|
2020-11-24 20:58:05 +00:00
|
|
|
grep -RI -e 'go:generate.*go-bindata' | cut -f1 -d: | while read -r filename; do
|
|
|
|
sed -i -e 's/go:generate.*go-bindata/go:generate go-bindata/' $filename
|
|
|
|
pushd $(dirname $filename)
|
|
|
|
go generate
|
|
|
|
popd
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2021-08-08 23:34:03 +00:00
|
|
|
tags = [ "assets" ];
|
|
|
|
|
|
|
|
ldflags = [ "-X main.commit=${shorthash}" "-X main.version=${version}" ];
|
|
|
|
|
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/";
|
|
|
|
maintainers = with maintainers; [ danderson ];
|
|
|
|
};
|
|
|
|
}
|