feat(grafana): jsonnet-based dashboards

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
This commit is contained in:
raito 2024-08-24 10:59:47 +02:00
parent aef541829e
commit d1ffce9336
3 changed files with 41 additions and 0 deletions

21
dashboards/default.nix Normal file
View file

@ -0,0 +1,21 @@
{ 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
'';
};
}

View file

@ -385,6 +385,22 @@
"type": "github"
}
},
"gerrit-dashboard": {
"flake": false,
"locked": {
"lastModified": 1724491526,
"narHash": "sha256-iBI8Rkcv3CYdZHz5hDI0104C+DgPZRh5K6Zcqz9iUWw=",
"ref": "refs/heads/master",
"rev": "d6badc64723b888a4cfa0cf966aec8b91dcb8a2b",
"revCount": 74,
"type": "git",
"url": "https://git.lix.systems/the-distro/gerrit-monitoring.git"
},
"original": {
"type": "git",
"url": "https://git.lix.systems/the-distro/gerrit-monitoring.git"
}
},
"grapevine": {
"inputs": {
"attic": "attic",
@ -669,6 +685,7 @@
"agenix": "agenix",
"buildbot-nix": "buildbot-nix",
"colmena": "colmena",
"gerrit-dashboard": "gerrit-dashboard",
"grapevine": "grapevine",
"hydra": "hydra",
"lix": [

View file

@ -19,6 +19,9 @@
nix-gerrit.url = "git+https://git.lix.systems/the-distro/nix-gerrit.git";
nix-gerrit.inputs.nixpkgs.follows = "nixpkgs";
gerrit-dashboard.url = "git+https://git.lix.systems/the-distro/gerrit-monitoring.git";
gerrit-dashboard.flake = false;
buildbot-nix.url = "git+https://git.lix.systems/lix-project/buildbot-nix.git?ref=refs/heads/non-flakes";
buildbot-nix.inputs.nixpkgs.follows = "nixpkgs";