NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.44k stars 13.65k forks source link

pkg request: pyzfs #131551

Open remexre opened 3 years ago

remexre commented 3 years ago

OpenZFS provides Python bindings to libzfs_core via pyzfs -- this ought to be built alongside the zfs derivations (possibly as an extra output).

hmenke commented 3 years ago

This is almost it, but for some reason the ZFS autotools build system refuses to detect the Python development headers.

--- a/pkgs/os-specific/linux/zfs/default.nix
+++ b/pkgs/os-specific/linux/zfs/default.nix
@@ -92,6 +92,13 @@ let
       buildInputs = optionals buildUser [ zlib libuuid attr libtirpc ]
         ++ optional buildUser openssl
         ++ optional (buildUser && enablePython) python3;
+      propagatedBuildInputs =
+        optionals (buildUser && enablePython) (with python3.pkgs; [
+          cffi
+          distlib
+          packaging
+          setuptools
+        ]);

       # for zdb to get the rpath to libgcc_s, needed for pthread_cancel to work
       NIX_CFLAGS_LINK = "-lgcc_s";
@@ -102,6 +109,7 @@ let
         "--with-config=${configFile}"
         "--with-tirpc=1"
         (withFeatureAs (buildUser && enablePython) "python" python3.interpreter)
+        (enableFeature (buildUser && enablePython) "pyzfs")
       ] ++ optionals buildUser [
         "--with-dracutdir=$(out)/lib/dracut"
         "--with-udevdir=$(out)/lib/udev"
$ nix-build -A zfs
[...]
checking for python version... 3.9
checking for python platform... linux
checking for python script directory... ${prefix}/lib/python3.9/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python3.9/site-packages
checking for python3.9... /nix/store/yqjhkdarf7p74wcha7aypzsb751n7wl2-python3-3.9.5/bin/python3.9
checking for a version of Python >= '2.1.0'... yes
checking for a version of Python >= '3.4.0'... yes
checking for the distutils Python package... yes
checking for Python include path... -I/nix/store/yqjhkdarf7p74wcha7aypzsb751n7wl2-python3-3.9.5/include/python3.9
checking for Python library path... -L/nix/store/yqjhkdarf7p74wcha7aypzsb751n7wl2-python3-3.9.5/lib -lpython3.9
checking for Python site-packages path... /nix/store/yqjhkdarf7p74wcha7aypzsb751n7wl2-python3-3.9.5/lib/python3.9/site-packages
checking python extra libraries... -lpthread -ldl -lcrypt -lncurses -lutil -lm -lm
checking python extra linking flags... -Xlinker -export-dynamic
checking consistency of all components of python development environment... no
configure: error: "Python >= '3.4.0' development library is not installed"
builder for '/nix/store/cwinkhm7728mlv7mza26b855wf6pszz4-zfs-user-2.1.0.drv' failed with exit code 1
error: build of '/nix/store/cwinkhm7728mlv7mza26b855wf6pszz4-zfs-user-2.1.0.drv' failed
stale[bot] commented 2 years ago

I marked this as stale due to inactivity. → More info