forked from the-distro/infra
22 lines
702 B
Nix
22 lines
702 B
Nix
{ stdenv, jsonnet, fetchFromGitHub, lib, ... }:
|
||
rec {
|
||
grafonnet = fetchFromGitHub {
|
||
owner = "grafana";
|
||
repo = "grafonnet-lib";
|
||
# TODO: figure out how to read the jsonnet lockfile
|
||
# and propagate this a bit cleverly.
|
||
rev = "a1d61cce1da59c71409b99b5c7568511fec661ea";
|
||
hash = "sha256-fs5JZJbcL6sQXBjYhp5eeRtjTFw0J1O/BcwBC8Vm9EM=";
|
||
};
|
||
buildJsonnetDashboards = dashboardSrc: target: stdenv.mkDerivation {
|
||
name = "jsonnet-grafana-dashboard-${baseNameOf target}";
|
||
src = dashboardSrc;
|
||
buildInputs = [ jsonnet ];
|
||
buildPhase = ''
|
||
runHook preBuild
|
||
jsonnet -J ${grafonnet} --ext-code publish=false ${target} > $out
|
||
runHook postBuild
|
||
'';
|
||
};
|
||
}
|