about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/nosql/influxdb2
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/servers/nosql/influxdb2')
-rw-r--r--nixpkgs/pkgs/servers/nosql/influxdb2/cli.nix33
-rw-r--r--nixpkgs/pkgs/servers/nosql/influxdb2/combined.nix12
-rw-r--r--nixpkgs/pkgs/servers/nosql/influxdb2/default.nix128
-rw-r--r--nixpkgs/pkgs/servers/nosql/influxdb2/no-deny-warnings.patch10
-rw-r--r--nixpkgs/pkgs/servers/nosql/influxdb2/provision.nix34
-rw-r--r--nixpkgs/pkgs/servers/nosql/influxdb2/token-manipulator.nix26
6 files changed, 243 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/servers/nosql/influxdb2/cli.nix b/nixpkgs/pkgs/servers/nosql/influxdb2/cli.nix
new file mode 100644
index 000000000000..10a3278c101b
--- /dev/null
+++ b/nixpkgs/pkgs/servers/nosql/influxdb2/cli.nix
@@ -0,0 +1,33 @@
+{ buildGoModule
+, fetchFromGitHub
+, lib
+}:
+
+let
+  version = "2.7.3";
+
+  src = fetchFromGitHub {
+    owner = "influxdata";
+    repo = "influx-cli";
+    rev = "v${version}";
+    sha256 = "sha256-hRv7f2NeURsgLQ1zNgAhZvTjS0ei4+5lqokIu0iN+aI=";
+  };
+
+in buildGoModule {
+  pname = "influx-cli";
+  version = version;
+  inherit src;
+
+  vendorHash = "sha256-QNhL5RPkNLTXoQ0NqcZuKec3ZBc3CDTc/XTWvjy55wk=";
+  subPackages = [ "cmd/influx" ];
+
+  ldflags = [ "-X main.commit=v${version}" "-X main.version=${version}" ];
+
+  meta = with lib; {
+    description = "CLI for managing resources in InfluxDB v2";
+    license = licenses.mit;
+    homepage = "https://influxdata.com/";
+    maintainers = with maintainers; [ abbradar danderson ];
+    mainProgram = "influx";
+  };
+}
diff --git a/nixpkgs/pkgs/servers/nosql/influxdb2/combined.nix b/nixpkgs/pkgs/servers/nosql/influxdb2/combined.nix
new file mode 100644
index 000000000000..285c94d01580
--- /dev/null
+++ b/nixpkgs/pkgs/servers/nosql/influxdb2/combined.nix
@@ -0,0 +1,12 @@
+{
+  buildEnv,
+  influxdb2-server,
+  influxdb2-cli,
+}:
+buildEnv {
+  name = "influxdb2";
+  paths = [
+    influxdb2-server
+    influxdb2-cli
+  ];
+}
diff --git a/nixpkgs/pkgs/servers/nosql/influxdb2/default.nix b/nixpkgs/pkgs/servers/nosql/influxdb2/default.nix
new file mode 100644
index 000000000000..7013b0cd6806
--- /dev/null
+++ b/nixpkgs/pkgs/servers/nosql/influxdb2/default.nix
@@ -0,0 +1,128 @@
+{ buildGoModule
+, fetchFromGitHub
+, fetchurl
+, fetchpatch
+, go-bindata
+, lib
+, perl
+, pkg-config
+, rustPlatform
+, stdenv
+, libiconv
+, nixosTests
+}:
+
+let
+  version = "2.7.1";
+  ui_version = "OSS-v${version}";
+  libflux_version = "0.193.0";
+
+  src = fetchFromGitHub {
+    owner = "influxdata";
+    repo = "influxdb";
+    rev = "v${version}";
+    hash = "sha256-JWu4V2k8ItbzBa421EtzgMVlDznoDdGjIhfDSaZ0j6c=";
+  };
+
+  ui = fetchurl {
+    url = "https://github.com/influxdata/ui/releases/download/${ui_version}/build.tar.gz";
+    hash = "sha256-0k59SKvt9pFt3WSd5PRUThbfbctt2RYtaxaxoyLICm8=";
+  };
+
+  flux = rustPlatform.buildRustPackage {
+    pname = "libflux";
+    version = "v${libflux_version}";
+    src = fetchFromGitHub {
+      owner = "influxdata";
+      repo = "flux";
+      rev = "v${libflux_version}";
+      hash = "sha256-gx6vnGOFu35wasLl7X/73eDsE0/50cAzjmBjZ+H2Ne4=";
+    };
+    patches = [
+      # Fix build with recent rust versions
+      (fetchpatch {
+        url = "https://github.com/influxdata/flux/commit/6dc8054cfeec4b65b5c7ae786d633240868b8589.patch";
+        stripLen = 2;
+        extraPrefix = "";
+        excludes = [ "rust-toolchain.toml" ];
+        hash = "sha256-w3z+Z26Xhy9TNICyNhc8XiWNSpdLA23ADI4K/AOMYhg=";
+      })
+      ./no-deny-warnings.patch
+    ];
+    sourceRoot = "${src.name}/libflux";
+    cargoSha256 = "sha256-MoI5nxLGA/3pduZ+vgmSG3lm3Nx58SP+6WXQl2pX9Lc=";
+    nativeBuildInputs = [ rustPlatform.bindgenHook ];
+    buildInputs = lib.optional stdenv.isDarwin libiconv;
+    pkgcfg = ''
+      Name: flux
+      Version: ${libflux_version}
+      Description: Library for the InfluxData Flux engine
+      Cflags: -I/out/include
+      Libs: -L/out/lib -lflux -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
+    '' + lib.optionalString stdenv.isDarwin ''
+      install_name_tool -id $out/lib/libflux.dylib $out/lib/libflux.dylib
+    '';
+  };
+
+in buildGoModule {
+  pname = "influxdb";
+  version = version;
+  inherit src;
+
+  nativeBuildInputs = [ go-bindata pkg-config perl ];
+
+  vendorHash = "sha256-5b1WRq3JndkOkKBhMzGZnSyBDY5Lk0UGe/WGHQJp0CQ=";
+  subPackages = [ "cmd/influxd" "cmd/telemetryd" ];
+
+  PKG_CONFIG_PATH = "${flux}/pkgconfig";
+
+  postPatch = ''
+    # use go-bindata from environment
+    substituteInPlace static/static.go \
+      --replace 'go run github.com/kevinburke/go-bindata/' ""
+  '';
+
+  # Check that libflux and the UI are at the right version, and embed
+  # the UI assets into the Go source tree.
+  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
+
+      ui_ver=$(egrep 'UI_RELEASE=".*"' scripts/fetch-ui-assets.sh | cut -d'"' -f2)
+      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
+  '';
+
+  tags = [ "assets" ];
+
+  ldflags = [ "-X main.commit=v${version}" "-X main.version=${version}" ];
+
+  passthru.tests = { inherit (nixosTests) influxdb2; };
+
+  meta = with lib; {
+    description = "An open-source distributed time series database";
+    license = licenses.mit;
+    homepage = "https://influxdata.com/";
+    maintainers = with maintainers; [ abbradar danderson ];
+  };
+}
diff --git a/nixpkgs/pkgs/servers/nosql/influxdb2/no-deny-warnings.patch b/nixpkgs/pkgs/servers/nosql/influxdb2/no-deny-warnings.patch
new file mode 100644
index 000000000000..3000ccad8256
--- /dev/null
+++ b/nixpkgs/pkgs/servers/nosql/influxdb2/no-deny-warnings.patch
@@ -0,0 +1,10 @@
+diff --git a/flux/src/lib.rs b/flux/src/lib.rs
+index 3fdf4071..a4c02277 100644
+--- a/flux/src/lib.rs
++++ b/flux/src/lib.rs
+@@ -1,5 +1,3 @@
+-#![cfg_attr(feature = "strict", deny(warnings, missing_docs))]
+-
+ //! This module provides the public facing API for Flux's Go runtime, including formatting,
+ //! parsing, and standard library analysis.
+ use std::sync::Arc;
diff --git a/nixpkgs/pkgs/servers/nosql/influxdb2/provision.nix b/nixpkgs/pkgs/servers/nosql/influxdb2/provision.nix
new file mode 100644
index 000000000000..dfb1d6083a71
--- /dev/null
+++ b/nixpkgs/pkgs/servers/nosql/influxdb2/provision.nix
@@ -0,0 +1,34 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, python3Packages
+, makeWrapper
+}:
+
+stdenv.mkDerivation rec {
+  pname = "influxdb2-provision";
+  version = "1.0.0";
+
+  src = fetchFromGitHub {
+    owner = "oddlama";
+    repo = "influxdb2-provision";
+    rev = "v${version}";
+    hash = "sha256-kgpUtXmwy9buupNzQj/6AIeN8XG2x0XjIckK3WIFC+I=";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ python3Packages.python python3Packages.influxdb-client ];
+
+  installPhase = ''
+    install -Dm0555 influxdb2-provision.py $out/bin/influxdb2-provision
+    wrapProgram $out/bin/influxdb2-provision --prefix PYTHONPATH : "$PYTHONPATH"
+  '';
+
+  meta = with lib; {
+    description = "A small utility to help provisioning influxdb2";
+    homepage = "https://github.com/oddlama/influxdb2-provision";
+    license = licenses.mit;
+    maintainers = with maintainers; [oddlama];
+    mainProgram = "influxdb2-provision";
+  };
+}
diff --git a/nixpkgs/pkgs/servers/nosql/influxdb2/token-manipulator.nix b/nixpkgs/pkgs/servers/nosql/influxdb2/token-manipulator.nix
new file mode 100644
index 000000000000..88713941b465
--- /dev/null
+++ b/nixpkgs/pkgs/servers/nosql/influxdb2/token-manipulator.nix
@@ -0,0 +1,26 @@
+{ buildGoModule
+, fetchFromGitHub
+, lib
+}:
+
+buildGoModule rec {
+  pname = "influxdb2-token-manipulator";
+  version = "1.0.0";
+
+  src = fetchFromGitHub {
+    owner = "oddlama";
+    repo = "influxdb2-token-manipulator";
+    rev = "v${version}";
+    hash = "sha256-9glz+TdqvGJgSsbLm4J/fn7kzMC75z74/jxZrEZiooc=";
+  };
+
+  vendorHash = "sha256-zBZk7JbNILX18g9+2ukiESnFtnIVWhdN/J/MBhIITh8=";
+
+  meta = with lib; {
+    description = "Utility program to manipulate influxdb api tokens for declarative setups";
+    homepage = "https://github.com/oddlama/influxdb2-token-manipulator";
+    license = licenses.mit;
+    maintainers = with maintainers; [oddlama];
+    mainProgram = "influxdb2-token-manipulator";
+  };
+}