nftables: split python package from main

Starting nftables 1.0.9, the python bindings are no longer built and
installed by the autotools build system and instead must be installed
manually.

Co-authored-by: ajs124 <ajs124@users.noreply.github.com>

Leorize e95a2286 85299b75

+32 -19
+1 -15
pkgs/os-specific/linux/nftables/default.nix
··· 5 5 , autoreconfHook 6 6 , withDebugSymbols ? false 7 7 , withCli ? true, libedit 8 - , withPython ? false, python3 9 8 , withXtables ? true, iptables 10 9 , nixosTests 11 10 }: ··· 29 28 libmnl libnftnl libpcap 30 29 gmp jansson 31 30 ] ++ lib.optional withCli libedit 32 - ++ lib.optional withXtables iptables 33 - ++ lib.optionals withPython [ 34 - python3 35 - python3.pkgs.setuptools 36 - ]; 37 - 38 - patches = [ ./fix-py-libnftables.patch ]; 39 - 40 - postPatch = '' 41 - substituteInPlace "py/src/nftables.py" \ 42 - --subst-var-by "out" "$out" 43 - ''; 31 + ++ lib.optional withXtables iptables; 44 32 45 33 configureFlags = [ 46 34 "--with-json" 47 35 (lib.withFeatureAs withCli "cli" "editline") 48 36 ] ++ lib.optional (!withDebugSymbols) "--disable-debug" 49 - ++ lib.optional (!withPython) "--disable-python" 50 - ++ lib.optional withPython "--enable-python" 51 37 ++ lib.optional withXtables "--with-xtables"; 52 38 53 39 passthru.tests = {
+28
pkgs/os-specific/linux/nftables/python.nix
··· 1 + { lib 2 + , buildPythonPackage 3 + , setuptools 4 + , nftables 5 + }: 6 + 7 + buildPythonPackage { 8 + pname = "nftables"; 9 + inherit (nftables) version src; 10 + pyproject = true; 11 + 12 + patches = [ ./fix-py-libnftables.patch ]; 13 + 14 + postPatch = '' 15 + substituteInPlace "py/src/nftables.py" \ 16 + --subst-var-by "out" "${nftables}" 17 + ''; 18 + 19 + setSourceRoot = "sourceRoot=$(echo */py)"; 20 + 21 + build-system = [ setuptools ]; 22 + 23 + pythonImportsCheck = [ "nftables" ]; 24 + 25 + meta = { 26 + inherit (nftables.meta) description homepage license platforms maintainers; 27 + }; 28 + }
+3 -4
pkgs/top-level/python-packages.nix
··· 8639 8639 8640 8640 nfcpy = callPackage ../development/python-modules/nfcpy { }; 8641 8641 8642 - nftables = toPythonModule (pkgs.nftables.override { 8643 - python3 = python; 8644 - withPython = true; 8645 - }); 8642 + nftables = callPackage ../os-specific/linux/nftables/python.nix { 8643 + inherit (pkgs) nftables; 8644 + }; 8646 8645 8647 8646 nh3 = callPackage ../development/python-modules/nh3 { }; 8648 8647