1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 libredirect,
6 systemd,
7 pkg-config,
8 pytest,
9 python,
10}:
11
12buildPythonPackage rec {
13 pname = "systemd";
14 version = "235";
15 format = "setuptools";
16
17 src = fetchFromGitHub {
18 owner = "systemd";
19 repo = "python-systemd";
20 rev = "v${version}";
21 hash = "sha256-8p4m4iM/z4o6PHRQIpuSXb64tPTWGlujEYCDVLiIt2o=";
22 };
23
24 nativeBuildInputs = [ pkg-config ];
25
26 buildInputs = [ systemd ];
27
28 nativeCheckInputs = [
29 libredirect.hook
30 pytest
31 ];
32
33 checkPhase = ''
34 echo "12345678901234567890123456789012" > machine-id
35 export NIX_REDIRECTS=/etc/machine-id=$(realpath machine-id) \
36
37 # Those tests assume /etc/machine-id to be available
38 # But our redirection technique does not work apparently
39 pytest $out/${python.sitePackages}/systemd -k 'not test_get_machine and not test_get_machine_app_specific and not test_reader_this_machine'
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; [ raitobezarius ];
55 };
56}