18 ui_version = "OSS-v2.7.1";
19 libflux_version = "0.194.5";
21 src = fetchFromGitHub {
25 hash = "sha256-0gqFUIV0ETdVuVmC+SwoKsO6OkoT/s+qKO1f8fkaZj4=";
29 url = "https://github.com/influxdata/ui/releases/download/${ui_version}/build.tar.gz";
30 hash = "sha256-0k59SKvt9pFt3WSd5PRUThbfbctt2RYtaxaxoyLICm8=";
33 flux = rustPlatform.buildRustPackage {
35 version = "v${libflux_version}";
36 src = fetchFromGitHub {
39 rev = "v${libflux_version}";
40 hash = "sha256-XHT/+JMu5q1cPjZT2x/OKEPgxFJcnjrQKqn8w9/Mb3s=";
43 # Fix build on Rust 1.78 (included after v0.195.0)
45 name = "fix-build-on-rust-1.78.patch";
46 url = "https://github.com/influxdata/flux/commit/68c831c40b396f0274f6a9f97d77707c39970b02.patch";
50 hash = "sha256-6LOTgbOCfETNTmshyXgtDZf9y4t/2iqRuVPkz9dYPHc=";
52 ./fix-unsigned-char.patch
54 sourceRoot = "${src.name}/libflux";
55 cargoHash = "sha256-O+t4f4P5291BuyARH6Xf3LejMFEQEBv+qKtyjHRhclA=";
56 nativeBuildInputs = [ rustPlatform.bindgenHook ];
57 buildInputs = lib.optional stdenv.hostPlatform.isDarwin libiconv;
60 Version: ${libflux_version}
61 Description: Library for the InfluxData Flux engine
62 Cflags: -I/out/include
63 Libs: -L/out/lib -lflux -lpthread
65 passAsFile = [ "pkgcfg" ];
68 mkdir -p $out/include $out/pkgconfig
69 cp -r $NIX_BUILD_TOP/source/libflux/include/influxdata $out/include
70 substitute $pkgcfgPath $out/pkgconfig/flux.pc \
73 + lib.optionalString stdenv.hostPlatform.isDarwin ''
74 install_name_tool -id $out/lib/libflux.dylib $out/lib/libflux.dylib
90 vendorHash = "sha256-3Vf8BCrOwliXrH+gmZ4RJ1YBEbqL0Szx2prW3ie9CNg=";
96 PKG_CONFIG_PATH = "${flux}/pkgconfig";
99 # use go-bindata from environment
100 substituteInPlace static/static.go \
101 --replace 'go run github.com/kevinburke/go-bindata/' ""
104 # Check that libflux and the UI are at the right version, and embed
105 # the UI assets into the Go source tree.
108 flux_ver=$(grep github.com/influxdata/flux go.mod | awk '{print $2}')
109 if [ "$flux_ver" != "v${libflux_version}" ]; then
110 echo "go.mod wants libflux $flux_ver, but nix derivation provides ${libflux_version}"
114 ui_ver=$(egrep 'UI_RELEASE=".*"' scripts/fetch-ui-assets.sh | cut -d'"' -f2)
115 if [ "$ui_ver" != "${ui_version}" ]; then
116 echo "scripts/fetch-ui-assets.sh wants UI $ui_ver, but nix derivation provides ${ui_version}"
122 tar -xzf ${ui} -C static/data
131 "-X main.commit=v${version}"
132 "-X main.version=${version}"
135 passthru.tests = { inherit (nixosTests) influxdb2; };
138 description = "Open-source distributed time series database";
139 license = licenses.mit;
140 homepage = "https://influxdata.com/";
141 maintainers = with maintainers; [ abbradar ];