Merge pull request #330634 from r-ryantm/auto-update/circumflex
[NixPkgs.git] / pkgs / servers / monitoring / prometheus / xmpp-alerts.nix
blobd710eea6c0813a5f925d694e3fc8c317d2cc7e10
1 { lib
2 , fetchFromGitHub
3 , python3Packages
4 , prometheus-alertmanager
5 , runCommand
6 , prometheus-xmpp-alerts
7 }:
9 python3Packages.buildPythonApplication rec {
10   pname = "prometheus-xmpp-alerts";
11   version = "0.5.8";
12   format = "pyproject";
14   src = fetchFromGitHub {
15     owner = "jelmer";
16     repo = pname;
17     rev = "v${version}";
18     sha256 = "sha256-iwqcowwJktZQfdxykpsw/MweAPY0KF7ojVwvk1LP8a4=";
19   };
21   postPatch = ''
22     substituteInPlace pyproject.toml \
23       --replace "bs4" "beautifulsoup4"
24   '';
26   propagatedBuildInputs = [
27     prometheus-alertmanager
28   ] ++ (with python3Packages; [
29     aiohttp
30     aiohttp-openmetrics
31     beautifulsoup4
32     jinja2
33     slixmpp
34     prometheus-client
35     pyyaml
36   ]);
38   nativeCheckInputs = with python3Packages; [
39     setuptools
40     unittestCheckHook
41     pytz
42   ];
44   pythonImportsCheck = [ "prometheus_xmpp" ];
46   passthru.tests = {
47     binaryWorks = runCommand "${pname}-binary-test" {} ''
48       # Running with --help to avoid it erroring due to a missing config file
49       ${prometheus-xmpp-alerts}/bin/prometheus-xmpp-alerts --help | tee $out
50       grep "usage: prometheus-xmpp-alerts" $out
51     '';
52   };
54   meta = {
55     description = "XMPP Web hook for Prometheus";
56     mainProgram = "prometheus-xmpp-alerts";
57     homepage = "https://github.com/jelmer/prometheus-xmpp-alerts";
58     maintainers = with lib.maintainers; [ fpletz ];
59     license = with lib.licenses; [ asl20 ];
60   };