1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-29 00:54:11 +00:00
nixpkgs/pkgs/servers/monitoring/grafana/plugins/grafana-plugin.nix
Luke Granger-Brown 3ba1a06a78 grafanaPlugins: init
This contains the base infrastructure (including a basic update script)
for maintaining Grafana plugins inside Nix, which, in a subsequent
commit, will be used for allowing the NixOS Grafana module to
automatically install plugins.
2020-12-30 17:30:54 +00:00

29 lines
694 B
Nix

{ stdenvNoCC, fetchurl, unzip }:
{ pname, version, zipHash, meta ? {}, passthru ? {}, ... }@args:
stdenvNoCC.mkDerivation ({
inherit pname version;
src = fetchurl {
name = "${pname}-${version}.zip";
url = "https://grafana.com/api/plugins/${pname}/versions/${version}/download";
hash = zipHash;
};
nativeBuildInputs = [ unzip ];
installPhase = ''
cp -R "." "$out"
chmod -R a-w "$out"
chmod u+w "$out"
'';
passthru = {
updateScript = [ ./update-grafana-plugin.sh pname ];
} // passthru;
meta = {
homepage = "https://grafana.com/grafana/plugins/${pname}";
} // meta;
} // (builtins.removeAttrs args [ "pname" "version" "sha256" "meta" ]))