@@ -0,0 +1,36 @@
1+{ fetchFromGitHub, python3Packages, lib }:
2+
3+python3Packages.buildPythonApplication rec {
4+ pname = "check_systemd";
5+ version = "2.2.1";
6+
7+ src = fetchFromGitHub {
8+ owner = "Josef-Friedrich";
9+ repo = pname;
10+ rev = "v${version}";
11+ sha256 = "04r14dhqzrdndn235dvr6afy4s4g4asynsgvj99cmyq55nah4asn";
12+ };
13+
14+ propagatedBuildInputs = with python3Packages; [ nagiosplugin ];
15+
16+ postInstall = ''
17+ # check_systemd is only a broken stub calling check_systemd.py
18+ mv $out/bin/check_systemd{.py,}
19+ '';
20+
21+ # the test scripts run ./check_systemd.py and check_systemd. Patch to
22+ # the installed, patchShebanged executable in $out/bin
23+ preCheck = ''
24+ find test -name "*.py" -execdir sed -i "s@./check_systemd.py@$out/bin/check_systemd@" '{}' ";"
25+ export PATH=$PATH:$out/bin
26+ '';
27+ checkInputs = [ python3Packages.pytestCheckHook ];
28+
29+ meta = with lib; {
30+ description = "Nagios / Icinga monitoring plugin to check systemd for failed units";
31+ inherit (src.meta) homepage;
32+ maintainers = with maintainers; [ symphorien ];
33+ license = licenses.lgpl2Only;
34+ platforms = platforms.linux;
35+ };
36+}