2021-05-20 23:08:51 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, python3Packages
|
|
|
|
, prometheus-alertmanager
|
2023-01-11 07:51:40 +00:00
|
|
|
, fetchpatch
|
|
|
|
, runCommand
|
|
|
|
, prometheus-xmpp-alerts
|
2021-05-20 23:08:51 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
python3Packages.buildPythonApplication rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "prometheus-xmpp-alerts";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "0.5.8";
|
|
|
|
format = "pyproject";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jelmer";
|
|
|
|
repo = pname;
|
2021-05-20 23:08:51 +00:00
|
|
|
rev = "v${version}";
|
2024-01-02 11:29:13 +00:00
|
|
|
sha256 = "sha256-iwqcowwJktZQfdxykpsw/MweAPY0KF7ojVwvk1LP8a4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
postPatch = ''
|
2024-01-02 11:29:13 +00:00
|
|
|
substituteInPlace pyproject.toml \
|
2022-12-17 10:02:37 +00:00
|
|
|
--replace "bs4" "beautifulsoup4"
|
|
|
|
'';
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
prometheus-alertmanager
|
|
|
|
] ++ (with python3Packages; [
|
|
|
|
aiohttp
|
2022-12-17 10:02:37 +00:00
|
|
|
aiohttp-openmetrics
|
|
|
|
beautifulsoup4
|
|
|
|
jinja2
|
2021-05-20 23:08:51 +00:00
|
|
|
slixmpp
|
2021-08-27 14:25:00 +00:00
|
|
|
prometheus-client
|
2021-05-20 23:08:51 +00:00
|
|
|
pyyaml
|
|
|
|
]);
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = with python3Packages; [
|
2024-01-02 11:29:13 +00:00
|
|
|
setuptools
|
2022-09-09 14:08:57 +00:00
|
|
|
unittestCheckHook
|
2021-05-20 23:08:51 +00:00
|
|
|
pytz
|
|
|
|
];
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
pythonImportsCheck = [ "prometheus_xmpp" ];
|
|
|
|
|
2023-01-11 07:51:40 +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-04-24 23:36:52 +00:00
|
|
|
meta = {
|
|
|
|
description = "XMPP Web hook for Prometheus";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "prometheus-xmpp-alerts";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/jelmer/prometheus-xmpp-alerts";
|
|
|
|
maintainers = with lib.maintainers; [ fpletz ];
|
|
|
|
license = with lib.licenses; [ asl20 ];
|
|
|
|
};
|
|
|
|
}
|