openwrt-prometheus-exporter: init at 2024.06.16

This commit is contained in:
soyouzpanda 2025-02-20 00:51:16 +01:00
parent ffd36f5da4
commit f17e7bb522
Signed by: ecoppens
GPG key ID: 871893E37A732093
2 changed files with 61 additions and 0 deletions

View file

@ -91,6 +91,7 @@ in {
odhcp-script = callPackage ./odhcp-script {};
odhcp6c = callPackage ./odhcp6c {};
openwrt = callPackage ./openwrt {};
openwrt-prometheus-exporter = callPackage ./openwrt-prometheus-exporter {};
ppp = callPackage ./ppp {};
pppoe = callPackage ./pppoe {};
preinit = callPackage ./preinit {};

View file

@ -0,0 +1,60 @@
{
lib,
stdenv,
fetchFromGitHub,
uhttpd,
ubus,
lua,
}:
let
pkg-path = "utils/prometheus-node-exporter-lua";
in
stdenv.mkDerivation rec {
pname = "openwrt-prometheus-exporter";
version = "2024.06.16";
src = fetchFromGitHub {
owner = "openwrt";
repo = "packages";
rev = "openwrt-${version}";
hash = "sha256-fPN+rgDpec86+3o9hFqgHg6eTULuXPf8jHhx5WL4udQ=";
};
buildInputs = [
uhttpd
ubus
lua
];
dontBuild = true;
patchPhase = ''
runHook prePatch
substituteInPlace ${pkg-path}/files/usr/bin/prometheus-node-exporter-lua \
--replace-fail "/usr/lib/lua/prometheus-collectors/*.lua" "$out/lib/lua/prometheus-collectors/*.lua"
runHook postPatch
'';
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,lib}
cp ${pkg-path}/files/usr/bin/prometheus-node-exporter-lua $out/bin/openwrt-prometheus-exporter
cp -r ${pkg-path}/files/usr/lib/ $out
runHook postInstall
'';
meta = {
description = "Community maintained packages for OpenWrt. Documentation for submitting pull requests is in CONTRIBUTING.md";
homepage = "https://github.com/openwrt/packages";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ soyouzpanda ];
mainProgram = "openwrt-prometheus-exporter";
platforms = lib.platforms.all;
};
}