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