grafanaPlugins.grafana-clickhouse-datasource: init at 3.1.0

This commit is contained in:
Jacob Moody 2023-05-26 20:46:32 -06:00 committed by Yureka
parent 390f3e17e0
commit 7005cdfa52
3 changed files with 34 additions and 8 deletions

View file

@ -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;
};
}

View file

@ -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" ]))

View file

@ -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 { };