From aed957bae710a77c000d01e6aba934f1b3008d0a Mon Sep 17 00:00:00 2001 From: "Ricardo M. Correia" Date: Thu, 9 Jan 2014 00:46:47 +0100 Subject: [PATCH] virt-manager: Fix error: 'ImportError: No module named libvirt' The problem was that libvirt 1.2.0 no longer includes the python bindings; it is a separate package now. --- .../virtualization/virt-manager/default.nix | 8 +++---- pkgs/top-level/python-packages.nix | 24 ++++++++++++++++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/virtualization/virt-manager/default.nix b/pkgs/applications/virtualization/virt-manager/default.nix index 99628eeecb21..c205a09baf4b 100644 --- a/pkgs/applications/virtualization/virt-manager/default.nix +++ b/pkgs/applications/virtualization/virt-manager/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, pythonPackages, intltool, libvirt, libxml2Python, curl, +{ stdenv, fetchurl, pythonPackages, intltool, libxml2Python, curl, python, makeWrapper, virtinst, pyGtkGlade, pythonDBus, gnome_python, gtkvnc, vte}: with stdenv.lib; @@ -18,13 +18,13 @@ stdenv.mkDerivation rec { paste_deploy m2crypto ipy boto_1_9 twisted sqlalchemy_migrate distutils_extra simplejson readline glance cheetah lockfile httplib2 # !!! should libvirt be a build-time dependency? Note that - # libxml2Python is a dependency of libvirt.py. + # libxml2Python is a dependency of libvirt.py. libvirt libxml2Python urlgrabber virtinst pyGtkGlade pythonDBus gnome_python gtkvnc vte ]; buildInputs = - [ pythonPackages.python + [ pythonPackages.python pythonPackages.wrapPython pythonPackages.mox pythonPackages.urlgrabber @@ -36,7 +36,7 @@ stdenv.mkDerivation rec { ] ++ pythonPath; buildPhase = "make"; - + nativeBuildInputs = [ makeWrapper pythonPackages.wrapPython ]; # patch the runner script in order to make wrapPythonPrograms work and run the program using a syscall diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 60b7e00f019d..18d323111739 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8195,7 +8195,29 @@ pythonPackages = modules // import ./python-packages-generated.nix { description = "A logging replacement for Python"; license = pkgs.lib.licenses.bsd3; }; - }; + }; + + libvirt = pkgs.stdenv.mkDerivation rec { + name = "libvirt-python-${version}"; + version = "1.2.0"; + + src = fetchurl { + url = "http://libvirt.org/sources/python/${name}.tar.gz"; + sha256 = "0azml1yv9iqnpj4sdg1wwsa70q7kb06lv85p63qwyd8vrd0y7rrg"; + }; + + buildInputs = [ python pkgs.pkgconfig pkgs.libvirt lxml ]; + + buildPhase = "python setup.py build"; + + installPhase = "python setup.py install --prefix=$out"; + + meta = { + homepage = http://www.libvirt.org/; + description = "libvirt Python bindings"; + license = "LGPLv2"; + }; + }; # python2.7 specific eggs } // pkgs.lib.optionalAttrs (python.majorVersion == "2.7") {