diff options
author | Jacob Moody <moody@posixcafe.org> | 2023-05-26 20:46:32 -0600 |
---|---|---|
committer | Yureka <yuka@yuka.dev> | 2023-06-13 10:27:44 +0200 |
commit | 7005cdfa529ce62445a2229632e0d101f7578bf3 (patch) | |
tree | be0e0028af010cc1e0e312d24476318b120d6147 /pkgs/servers/monitoring | |
parent | 390f3e17e0982f78e0cb6a7a3d59aeffc719ee68 (diff) |
grafanaPlugins.grafana-clickhouse-datasource: init at 3.1.0
Diffstat (limited to 'pkgs/servers/monitoring')
3 files changed, 34 insertions, 8 deletions
diff --git a/pkgs/servers/monitoring/grafana/plugins/grafana-clickhouse-datasource/default.nix b/pkgs/servers/monitoring/grafana/plugins/grafana-clickhouse-datasource/default.nix new file mode 100644 index 0000000000000..4d4f0516e3040 --- /dev/null +++ b/pkgs/servers/monitoring/grafana/plugins/grafana-clickhouse-datasource/default.nix @@ -0,0 +1,19 @@ +{ grafanaPlugin, lib }: + +grafanaPlugin rec { + pname = "grafana-clickhouse-datasource"; + version = "3.1.0"; + zipHash = { + x86_64-linux = "sha256-x/Uruhk7mhPbsfAcST6tLnxJDd4vlqIkOUI4nAOZN50="; + aarch64-linux = "sha256-nNAIKoXYyhT1fwSB/a+uD1XUe5RxE9MYrbtHHx6T1fI="; + x86_64-darwin = "sha256-u9KRR7k/ktMu1KO5tpN/A+x48yDyXXPEnSNEx0hkT8Y="; + aarch64-darwin = "sha256-ME/LkVXoN1Sp4L3e9qFXgBfa7mCLRyKfEGHiBbaN8iY="; + }; + meta = with lib; { + description = "Connects Grafana to ClickHouse"; + license = licenses.asl20; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + maintainers = with maintainers; [ moody yuka ]; + platforms = attrNames zipHash; + }; +} diff --git a/pkgs/servers/monitoring/grafana/plugins/grafana-plugin.nix b/pkgs/servers/monitoring/grafana/plugins/grafana-plugin.nix index 3b3cee88fd7a1..25a381e2a8fa8 100644 --- a/pkgs/servers/monitoring/grafana/plugins/grafana-plugin.nix +++ b/pkgs/servers/monitoring/grafana/plugins/grafana-plugin.nix @@ -1,14 +1,20 @@ -{ stdenvNoCC, fetchurl, unzip }: +{ stdenvNoCC, fetchurl, unzip, lib }: { pname, version, zipHash, meta ? {}, passthru ? {}, ... }@args: -stdenvNoCC.mkDerivation ({ +let plat = stdenvNoCC.targetPlatform.system; in stdenvNoCC.mkDerivation ({ inherit pname version; - src = fetchurl { - name = "${pname}-${version}.zip"; - url = "https://grafana.com/api/plugins/${pname}/versions/${version}/download"; - hash = zipHash; - }; + src = (fetchurl { + name = "${pname}-${version}-${plat}.zip"; + hash = if lib.isAttrs zipHash then zipHash.${plat} or (throw "unsupported system") else zipHash; + url = "https://grafana.com/api/plugins/${pname}/versions/${version}/download" + + { + x86_64-linux = "?os=linux&arch=amd64"; + aarch64-linux = "?os=linux&arch=arm64"; + x86_64-darwin = "?os=darwin&arch=amd64"; + aarch64-darwin = "?os=darwin&arch=arm64"; + }.${plat} or (throw "unknown system"); + }); nativeBuildInputs = [ unzip ]; @@ -25,4 +31,4 @@ stdenvNoCC.mkDerivation ({ meta = { homepage = "https://grafana.com/grafana/plugins/${pname}"; } // meta; -} // (builtins.removeAttrs args [ "pname" "version" "sha256" "meta" ])) +} // (builtins.removeAttrs args [ "zipHash" "pname" "version" "sha256" "meta" ])) diff --git a/pkgs/servers/monitoring/grafana/plugins/plugins.nix b/pkgs/servers/monitoring/grafana/plugins/plugins.nix index 163de4c96025c..8bbd738f7ab92 100644 --- a/pkgs/servers/monitoring/grafana/plugins/plugins.nix +++ b/pkgs/servers/monitoring/grafana/plugins/plugins.nix @@ -6,6 +6,7 @@ doitintl-bigquery-datasource = callPackage ./doitintl-bigquery-datasource { }; grafadruid-druid-datasource = callPackage ./grafadruid-druid-datasource { }; + grafana-clickhouse-datasource = callPackage ./grafana-clickhouse-datasource { }; grafana-clock-panel = callPackage ./grafana-clock-panel { }; grafana-piechart-panel = callPackage ./grafana-piechart-panel { }; grafana-polystat-panel = callPackage ./grafana-polystat-panel { }; |