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 # Those tests assume /etc/machine-id to be available
40 # But our redirection technique does not work apparently
41 pytest $out/${python.sitePackages}/systemd -k 'not test_get_machine and not test_get_machine_app_specific and not test_reader_this_machine'
42 '';
43
44 pythonImportsCheck = [
45 "systemd.journal"
46 "systemd.id128"
47 "systemd.daemon"
48 "systemd.login"
49 ];
50
51 meta = with lib; {
52 description = "Python module for native access to the systemd facilities";
53 homepage = "https://www.freedesktop.org/software/systemd/python-systemd/";
54 changelog = "https://github.com/systemd/python-systemd/blob/v${version}/NEWS";
55 license = licenses.lgpl21Plus;
56 maintainers = with maintainers; [ raitobezarius ];
57 };
58}