0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 06:00:33 +03:00

grafanaPlugins.grafanaPlugin: add platform only when multiple zipHash are specified (#237513)

This commit is contained in:
Yureka 2023-06-13 11:10:28 +02:00 committed by GitHub
parent f20ce65f2e
commit 96ce8d5964
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,17 +4,24 @@
let plat = stdenvNoCC.targetPlatform.system; in stdenvNoCC.mkDerivation ({ let plat = stdenvNoCC.targetPlatform.system; in stdenvNoCC.mkDerivation ({
inherit pname version; inherit pname version;
src = (fetchurl { src = if lib.isAttrs zipHash then
name = "${pname}-${version}-${plat}.zip"; fetchurl {
hash = if lib.isAttrs zipHash then zipHash.${plat} or (throw "unsupported system") else zipHash; name = "${pname}-${version}-${plat}.zip";
url = "https://grafana.com/api/plugins/${pname}/versions/${version}/download" + hash = zipHash.${plat} or (throw "unsupported system");
{ url = "https://grafana.com/api/plugins/${pname}/versions/${version}/download" + {
x86_64-linux = "?os=linux&arch=amd64"; x86_64-linux = "?os=linux&arch=amd64";
aarch64-linux = "?os=linux&arch=arm64"; aarch64-linux = "?os=linux&arch=arm64";
x86_64-darwin = "?os=darwin&arch=amd64"; x86_64-darwin = "?os=darwin&arch=amd64";
aarch64-darwin = "?os=darwin&arch=arm64"; aarch64-darwin = "?os=darwin&arch=arm64";
}.${plat} or (throw "unknown system"); }.${plat} or (throw "unknown system");
}); }
else
fetchurl {
name = "${pname}-${version}.zip";
hash = zipHash;
url = "https://grafana.com/api/plugins/${pname}/versions/${version}/download";
}
;
nativeBuildInputs = [ unzip ]; nativeBuildInputs = [ unzip ];