about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/libknot/default.nix
blob: fd5b0451381bc2167af01971d4b3fa06b0609c0d (plain) (blame)
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
{ lib
, buildPythonPackage
, fetchPypi

# build-system
, hatchling

# native dependencies
, knot-dns
}:

buildPythonPackage rec {
  pname = "libknot";
  version = "3.3.3";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-w8VAA+llRg1xeAMRe7ISHo8H+qGi247jwOjTZHecFVM=";
  };

  postPatch = ''
    substituteInPlace libknot/__init__.py \
      --replace "libknot%s.dylib" "${lib.getLib knot-dns}/lib/libknot%s.dylib" \
      --replace "libknot.so%s" "${lib.getLib knot-dns}/lib/libknot.so%s"
  '';

  nativeBuildInputs = [
    hatchling
  ];

  pythonImportsCheck = [
    "libknot"
  ];

  meta = with lib; {
    description = "Python bindings for libknot";
    homepage = "https://gitlab.nic.cz/knot/knot-dns/-/tree/master/python/libknot";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ hexa ];
    mainProgram = "libknot";
  };
}