2021-12-16 19:37:21 +00:00
|
|
|
{ buildGoModule
|
2020-11-24 15:06:39 +00:00
|
|
|
, fetchFromGitHub
|
2021-09-20 11:22:05 +00:00
|
|
|
, fetchurl
|
2022-10-12 18:10:33 +00:00
|
|
|
, fetchpatch
|
2020-11-24 15:06:39 +00:00
|
|
|
, go-bindata
|
|
|
|
, lib
|
|
|
|
, llvmPackages
|
2021-11-28 09:27:34 +00:00
|
|
|
, perl
|
2020-11-24 15:06:39 +00:00
|
|
|
, pkg-config
|
|
|
|
, rustPlatform
|
2021-05-16 11:32:20 +00:00
|
|
|
, stdenv
|
|
|
|
, libiconv
|
2020-11-24 15:06:39 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2022-11-13 21:30:01 +00:00
|
|
|
version = "2.5.1";
|
2022-09-18 07:49:54 +00:00
|
|
|
# Despite the name, this is not a rolling release. This is the
|
2022-11-13 21:30:01 +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 15:06:39 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "influxdata";
|
|
|
|
repo = "influxdb";
|
|
|
|
rev = "v${version}";
|
2022-11-13 21:30:01 +00:00
|
|
|
sha256 = "sha256-AKyuFBja06BuWYliqIGKOb4PIc5G8S9S+cf/dLrEATY=";
|
2020-11-24 15:06:39 +00:00
|
|
|
};
|
|
|
|
|
2021-09-20 11:22:05 +00:00
|
|
|
ui = fetchurl {
|
2022-11-13 21:30:01 +00:00
|
|
|
url = "https://github.com/influxdata/ui/releases/download/${ui_version}/build.tar.gz";
|
2022-09-18 07:49:54 +00:00
|
|
|
sha256 = "sha256-YKDp1jLyo4n+YTeMaWl8dhN4Lr3H8FXV7stJ3p3zFe8=";
|
2020-11-24 15:06:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
flux = rustPlatform.buildRustPackage {
|
|
|
|
pname = "libflux";
|
|
|
|
version = "v${libflux_version}";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "influxdata";
|
|
|
|
repo = "flux";
|
|
|
|
rev = "v${libflux_version}";
|
2022-11-13 21:30:01 +00:00
|
|
|
sha256 = "sha256-Xmh7V/o1Gje62kcnTeB9h/fySljhfu+tjbyvryvIGRc=";
|
2020-11-24 15:06:39 +00:00
|
|
|
};
|
|
|
|
sourceRoot = "source/libflux";
|
2022-11-13 21:30:01 +00:00
|
|
|
cargoSha256 = "sha256-9rPW0lgi3lXJARa1KXgSY8LVJsoFjppok5ODGlqYeYw=";
|
2020-11-24 15:06:39 +00:00
|
|
|
nativeBuildInputs = [ llvmPackages.libclang ];
|
2021-05-16 11:32:20 +00:00
|
|
|
buildInputs = lib.optional stdenv.isDarwin libiconv;
|
llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb391ed002046090851a44c452b80bdbd, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2020-10-15 08:23:57 +00:00
|
|
|
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
|
2020-11-24 15:06:39 +00:00
|
|
|
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
|
2020-11-24 15:06:39 +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
|
2021-05-16 11:32:20 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
|
|
|
install_name_tool -id $out/lib/libflux.dylib $out/lib/libflux.dylib
|
2020-11-24 15:06:39 +00:00
|
|
|
'';
|
|
|
|
};
|
2021-11-28 09:27:34 +00:00
|
|
|
|
2021-12-16 19:37:21 +00:00
|
|
|
in buildGoModule {
|
2020-11-24 15:06:39 +00:00
|
|
|
pname = "influxdb";
|
|
|
|
version = version;
|
2022-11-13 21:30:01 +00:00
|
|
|
inherit src;
|
2020-11-24 15:06:39 +00:00
|
|
|
|
2022-10-12 18:56:07 +00:00
|
|
|
nativeBuildInputs = [ go-bindata pkg-config perl ];
|
2020-11-24 15:06:39 +00:00
|
|
|
|
2022-11-13 21:30:01 +00:00
|
|
|
vendorSha256 = "sha256-02x+HsWkng7OnKVSfkQR8LL1Qk42Bdrw0IMtBpS7xQc=";
|
2021-12-16 19:37:21 +00:00
|
|
|
subPackages = [ "cmd/influxd" "cmd/telemetryd" ];
|
2020-11-24 15:06:39 +00:00
|
|
|
|
|
|
|
PKG_CONFIG_PATH = "${flux}/pkgconfig";
|
2022-10-12 18:56:07 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# use go-bindata from environment
|
|
|
|
substituteInPlace static/static.go \
|
|
|
|
--replace 'go run github.com/kevinburke/go-bindata/' ""
|
|
|
|
'';
|
|
|
|
|
2021-11-28 09:27:34 +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 15:06:39 +00:00
|
|
|
preBuild = ''
|
2021-11-28 09:27:34 +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
|
|
|
|
|
2022-11-13 21:30:01 +00:00
|
|
|
ui_ver=$(egrep 'UI_RELEASE=".*"' scripts/fetch-ui-assets.sh | cut -d'"' -f2)
|
2021-11-28 09:27:34 +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
|
|
|
|
)
|
2021-09-20 11:22:05 +00:00
|
|
|
|
2021-11-28 09:27:34 +00:00
|
|
|
mkdir -p static/data
|
|
|
|
tar -xzf ${ui} -C static/data
|
|
|
|
pushd static
|
|
|
|
go generate
|
|
|
|
popd
|
|
|
|
'';
|
2020-11-24 15:06:39 +00:00
|
|
|
|
2021-08-07 02:28:40 +00:00
|
|
|
tags = [ "assets" ];
|
|
|
|
|
2021-11-28 09:27:34 +00:00
|
|
|
ldflags = [ "-X main.commit=v${version}" "-X main.version=${version}" ];
|
2021-08-07 02:28:40 +00:00
|
|
|
|
2020-11-24 15:06:39 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "An open-source distributed time series database";
|
|
|
|
license = licenses.mit;
|
|
|
|
homepage = "https://influxdata.com/";
|
2021-12-16 19:37:21 +00:00
|
|
|
maintainers = with maintainers; [ abbradar danderson ];
|
2020-11-24 15:06:39 +00:00
|
|
|
};
|
|
|
|
}
|