1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, libredirect
5, systemd
6, pkg-config
7, pytest
8, python
9}:
10
11buildPythonPackage rec {
12 pname = "systemd";
13 version = "235";
14
15 src = fetchFromGitHub {
16 owner = "systemd";
17 repo = "python-systemd";
18 rev = "v${version}";
19 hash = "sha256-8p4m4iM/z4o6PHRQIpuSXb64tPTWGlujEYCDVLiIt2o=";
20 };
21
22 nativeBuildInputs = [
23 pkg-config
24 ];
25
26 buildInputs = [
27 systemd
28 ];
29
30 nativeCheckInputs = [
31 pytest
32 ];
33
34 checkPhase = ''
35 echo "12345678901234567890123456789012" > machine-id
36 export NIX_REDIRECTS=/etc/machine-id=$(realpath machine-id) \
37 LD_PRELOAD=${libredirect}/lib/libredirect.so
38
39 pytest $out/${python.sitePackages}/systemd
40 '';
41
42 pythonImportsCheck = [
43 "systemd.journal"
44 "systemd.id128"
45 "systemd.daemon"
46 "systemd.login"
47 ];
48
49 meta = with lib; {
50 description = "Python module for native access to the systemd facilities";
51 homepage = "https://www.freedesktop.org/software/systemd/python-systemd/";
52 changelog = "https://github.com/systemd/python-systemd/blob/v${version}/NEWS";
53 license = licenses.lgpl21Plus;
54 maintainers = with maintainers; [ SuperSandro2000 ];
55 };
56}