summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/systemd-python/default.nix
blob: 4722cb04ff406e48e0d25ad90230452a51f44461 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  libredirect,
  systemd,
  pkg-config,
  pytest,
  python,
  setuptools,
}:

buildPythonPackage rec {
  pname = "systemd-python";
  version = "235";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "systemd";
    repo = "python-systemd";
    tag = "v${version}";
    hash = "sha256-8p4m4iM/z4o6PHRQIpuSXb64tPTWGlujEYCDVLiIt2o=";
  };

  build-system = [ setuptools ];

  nativeBuildInputs = [ pkg-config ];

  buildInputs = [ systemd ];

  nativeCheckInputs = [
    libredirect.hook
    pytest
  ];

  checkPhase = ''
    echo "12345678901234567890123456789012" > machine-id
    export NIX_REDIRECTS=/etc/machine-id=$(realpath machine-id) \

    # Those tests assume /etc/machine-id to be available
    # But our redirection technique does not work apparently
    pytest $out/${python.sitePackages}/systemd -k 'not test_get_machine and not test_get_machine_app_specific and not test_reader_this_machine'
  '';

  pythonImportsCheck = [
    "systemd.journal"
    "systemd.id128"
    "systemd.daemon"
    "systemd.login"
  ];

  meta = {
    description = "Python module for native access to the systemd facilities";
    homepage = "https://www.freedesktop.org/software/systemd/python-systemd/";
    changelog = "https://github.com/systemd/python-systemd/blob/v${version}/NEWS";
    license = lib.licenses.lgpl21Plus;
    maintainers = with lib.maintainers; [ raitobezarius ];
  };
}