2021-04-29 21:29:51 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, python3Packages
|
|
|
|
, prometheus-alertmanager
|
2022-12-31 14:53:30 +00:00
|
|
|
, fetchpatch
|
|
|
|
, runCommand
|
|
|
|
, prometheus-xmpp-alerts
|
2021-04-29 21:29:51 +00:00
|
|
|
}:
|
2020-02-01 14:02:58 +00:00
|
|
|
|
2021-04-29 21:29:51 +00:00
|
|
|
python3Packages.buildPythonApplication rec {
|
2020-02-01 14:02:58 +00:00
|
|
|
pname = "prometheus-xmpp-alerts";
|
2022-12-10 21:53:39 +00:00
|
|
|
version = "0.5.6";
|
2020-02-01 14:02:58 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jelmer";
|
|
|
|
repo = pname;
|
2021-04-29 21:29:51 +00:00
|
|
|
rev = "v${version}";
|
2022-12-10 21:53:39 +00:00
|
|
|
sha256 = "sha256-PwShGS1rbfZCK5OS6Cnn+mduOpWAD4fC69mcGB5GB1c=";
|
2020-02-01 14:02:58 +00:00
|
|
|
};
|
|
|
|
|
2022-12-31 14:53:30 +00:00
|
|
|
patches = [
|
|
|
|
# Required until https://github.com/jelmer/prometheus-xmpp-alerts/pull/33 is merged
|
|
|
|
# and contained in a release
|
|
|
|
(fetchpatch {
|
|
|
|
name = "Fix-outdated-entrypoint-definiton.patch";
|
|
|
|
url = "https://github.com/jelmer/prometheus-xmpp-alerts/commit/c41dd41dbd3c781b874bcf0708f6976e6252b621.patch";
|
|
|
|
hash = "sha256-G7fRLSXbkI5EDgGf4n9xSVs54IPD0ev8rTEFffRvLY0=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-12-10 21:53:39 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.cfg \
|
|
|
|
--replace "bs4" "beautifulsoup4"
|
|
|
|
'';
|
|
|
|
|
2021-04-29 21:29:51 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
prometheus-alertmanager
|
|
|
|
] ++ (with python3Packages; [
|
|
|
|
aiohttp
|
2022-12-10 21:53:39 +00:00
|
|
|
aiohttp-openmetrics
|
|
|
|
beautifulsoup4
|
|
|
|
jinja2
|
2021-04-29 21:29:51 +00:00
|
|
|
slixmpp
|
2021-08-26 00:08:48 +00:00
|
|
|
prometheus-client
|
2021-04-29 21:29:51 +00:00
|
|
|
pyyaml
|
|
|
|
]);
|
|
|
|
|
2023-01-21 12:00:00 +00:00
|
|
|
nativeCheckInputs = with python3Packages; [
|
2022-08-06 16:32:04 +00:00
|
|
|
unittestCheckHook
|
2021-04-29 21:29:51 +00:00
|
|
|
pytz
|
|
|
|
];
|
|
|
|
|
2022-12-10 21:53:39 +00:00
|
|
|
pythonImportsCheck = [ "prometheus_xmpp" ];
|
|
|
|
|
2022-12-31 14:53:30 +00:00
|
|
|
passthru.tests = {
|
|
|
|
binaryWorks = runCommand "${pname}-binary-test" {} ''
|
|
|
|
# Running with --help to avoid it erroring due to a missing config file
|
|
|
|
${prometheus-xmpp-alerts}/bin/prometheus-xmpp-alerts --help | tee $out
|
|
|
|
grep "usage: prometheus-xmpp-alerts" $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2020-02-01 14:02:58 +00:00
|
|
|
meta = {
|
|
|
|
description = "XMPP Web hook for Prometheus";
|
|
|
|
homepage = "https://github.com/jelmer/prometheus-xmpp-alerts";
|
|
|
|
maintainers = with lib.maintainers; [ fpletz ];
|
|
|
|
license = with lib.licenses; [ asl20 ];
|
|
|
|
};
|
|
|
|
}
|