mirror of
https://github.com/Stunkymonkey/nixos.git
synced 2025-05-24 09:54:40 +02:00
pkgs/grafana-dashboards: modularize
This commit is contained in:
parent
1760b2f1dc
commit
354be79f0e
4 changed files with 38 additions and 30 deletions
36
pkgs/grafana-dashboards/default.nix
Normal file
36
pkgs/grafana-dashboards/default.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{ pkgs }:
|
||||
|
||||
with pkgs;
|
||||
|
||||
let
|
||||
inherit (pkgs) stdenv fetchurl;
|
||||
in
|
||||
|
||||
lib.makeScope pkgs.newScope (self:
|
||||
let
|
||||
buildGrafanaDashboard = args: stdenv.mkDerivation (args // {
|
||||
pname = "grafana-dashboard-${args.pname}-${toString args.id}";
|
||||
inherit (args) version;
|
||||
src = fetchurl {
|
||||
url = "https://grafana.com/api/dashboards/${toString args.id}/revisions/${args.version}/download";
|
||||
hash = args.hash;
|
||||
};
|
||||
dontUnpack = true;
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out
|
||||
cp $src $out/${args.pname}-${toString args.id}.json
|
||||
runHook postInstall
|
||||
'';
|
||||
});
|
||||
in
|
||||
{
|
||||
inherit buildGrafanaDashboard;
|
||||
|
||||
node-exporter = buildGrafanaDashboard {
|
||||
id = 1860;
|
||||
pname = "node-exporter-full";
|
||||
version = "31";
|
||||
hash = "sha256-QsRHsnayYRRGc+2MfhaKGYpNdH02PesnR5b50MDzHIg=";
|
||||
};
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue