diff options
Diffstat (limited to 'pkgs/servers/monitoring/grafana/plugins/grafana-plugin.nix')
-rw-r--r-- | pkgs/servers/monitoring/grafana/plugins/grafana-plugin.nix | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/pkgs/servers/monitoring/grafana/plugins/grafana-plugin.nix b/pkgs/servers/monitoring/grafana/plugins/grafana-plugin.nix index 57af5d2654527..2351df623a561 100644 --- a/pkgs/servers/monitoring/grafana/plugins/grafana-plugin.nix +++ b/pkgs/servers/monitoring/grafana/plugins/grafana-plugin.nix @@ -1,14 +1,14 @@ { stdenvNoCC, fetchurl, unzip, lib }: -{ pname, version, zipHash, meta ? {}, passthru ? {}, ... }@args: +{ pname, versionPrefix ? "", version, zipHash, meta ? {}, passthru ? {}, ... }@args: let plat = stdenvNoCC.hostPlatform.system; in stdenvNoCC.mkDerivation ({ - inherit pname version; + inherit pname versionPrefix version; src = if lib.isAttrs zipHash then fetchurl { - name = "${pname}-${version}-${plat}.zip"; + name = "${pname}-${versionPrefix}${version}-${plat}.zip"; hash = zipHash.${plat} or (throw "Unsupported system: ${plat}"); - url = "https://grafana.com/api/plugins/${pname}/versions/${version}/download" + { + url = "https://grafana.com/api/plugins/${pname}/versions/${versionPrefix}${version}/download" + { x86_64-linux = "?os=linux&arch=amd64"; aarch64-linux = "?os=linux&arch=arm64"; x86_64-darwin = "?os=darwin&arch=amd64"; @@ -17,9 +17,9 @@ let plat = stdenvNoCC.hostPlatform.system; in stdenvNoCC.mkDerivation ({ } else fetchurl { - name = "${pname}-${version}.zip"; + name = "${pname}-${versionPrefix}${version}.zip"; hash = zipHash; - url = "https://grafana.com/api/plugins/${pname}/versions/${version}/download"; + url = "https://grafana.com/api/plugins/${pname}/versions/${versionPrefix}${version}/download"; } ; @@ -38,4 +38,4 @@ let plat = stdenvNoCC.hostPlatform.system; in stdenvNoCC.mkDerivation ({ meta = { homepage = "https://grafana.com/grafana/plugins/${pname}"; } // meta; -} // (builtins.removeAttrs args [ "zipHash" "pname" "version" "sha256" "meta" ])) +} // (builtins.removeAttrs args [ "zipHash" "pname" "versionPrefix" "version" "sha256" "meta" ])) |