diff --git a/pkgs/desktops/kde-4.7/admin.nix b/pkgs/desktops/kde-4.7/admin.nix new file mode 100644 index 000000000000..60a4d3e65c8d --- /dev/null +++ b/pkgs/desktops/kde-4.7/admin.nix @@ -0,0 +1,50 @@ +{ kde, cmake, qt4, pkgconfig, perl, pythonPackages +, sip, pycups, pygobject, system_config_printer +, kdelibs, automoc4, phonon, kdepimlibs, pykde4 +, cups, nettools } @ args: + +let + + system_config_printer = args.system_config_printer.override { withGUI = false; }; + +in + +kde.package rec { + + buildInputs = + [ cmake kdelibs qt4 automoc4 phonon kdepimlibs + pythonPackages.python + pycups pykde4 sip pygobject system_config_printer + ]; + + passthru = { inherit system_config_printer; }; + + preConfigure = + '' + for i in system-config-printer-kde/cmake-modules/FindSystemConfigPrinter.py system-config-printer-kde/system-config-printer-kde.py; do + substituteInPlace $i \ + --replace /usr/share/system-config-printer ${system_config_printer}/share/system-config-printer \ + --replace /usr/bin/cupstestppd ${cups}/bin/cupstestppd \ + --replace /bin/hostname ${nettools}/bin/hostname + done + ''; + + postInstall = + '' + # Bake the required Python path into the printer configuration program. + res= + for i in $(IFS=:; echo $PYTHONPATH); do res="$res''${res:+,} '$i'"; done + + sed -i $out/share/apps/system-config-printer-kde/system-config-printer-kde.py \ + -e "1 a import sys\nsys.path = [$res] + sys.path" + + mkdir -p $out/nix-support + echo ${pykde4} > $out/nix-support/propagated-user-env-packages + ''; + + meta = { + description = "KDE Administration Utilities"; + license = "GPL"; + kde.name = "kdeadmin"; + }; +} diff --git a/pkgs/desktops/kde-4.7/admin/builder.sh b/pkgs/desktops/kde-4.7/admin/builder.sh deleted file mode 100644 index 78e29543c1f0..000000000000 --- a/pkgs/desktops/kde-4.7/admin/builder.sh +++ /dev/null @@ -1,13 +0,0 @@ -source $stdenv/setup - -myPatchPhase() -{ - for i in system-config-printer-kde/cmake-modules/FindSystemConfigPrinter.py system-config-printer-kde/system-config-printer-kde.py - do - sed -i -e "s|/usr/share/system-config-printer|$system_config_printer/share/system-config-printer|" $i - done - - sed -i -e "s|import cupshelpers.ppds, cupshelpers.cupshelpers|import ppds, cupshelpers|" system-config-printer-kde/cmake-modules/FindSystemConfigPrinter.py -} -patchPhase=myPatchPhase -genericBuild diff --git a/pkgs/desktops/kde-4.7/admin/default.nix b/pkgs/desktops/kde-4.7/admin/default.nix deleted file mode 100644 index c3b5a70b1dc5..000000000000 --- a/pkgs/desktops/kde-4.7/admin/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ kde, cmake, qt4, pkgconfig, perl, python -, sip, pyqt4, pycups, rhpl, system_config_printer -, kdelibs, kdepimlibs, kdebindings, automoc4}: - -kde.package { - - builder = ./builder.sh; - - inherit system_config_printer; - - # TODO: split, check which packages work on nixos - - PYTHONPATH = "${pycups}/lib/python${python.majorVersion}/site-packages"; - - buildInputs = [ cmake qt4 pkgconfig perl python sip pyqt4 pycups rhpl system_config_printer - kdelibs kdepimlibs kdebindings automoc4 ]; - - meta = { - description = "KDE Administration Utilities"; - license = "GPL"; - kde.name = "kdeadmin"; - }; -} diff --git a/pkgs/desktops/kde-4.7/default.nix b/pkgs/desktops/kde-4.7/default.nix index 373b3ee7819d..83af1eaeb4d6 100644 --- a/pkgs/desktops/kde-4.7/default.nix +++ b/pkgs/desktops/kde-4.7/default.nix @@ -83,6 +83,8 @@ recurseIntoAttrs rec { kde_wallpapers = callPackage ./wallpapers.nix { }; + kdeadmin = callPackage ./admin.nix { }; + kdegames = callPackage ./games.nix { }; /* diff --git a/pkgs/desktops/kde-4.7/games.nix b/pkgs/desktops/kde-4.7/games.nix index 93a262452e54..c005e5088687 100644 --- a/pkgs/desktops/kde-4.7/games.nix +++ b/pkgs/desktops/kde-4.7/games.nix @@ -13,10 +13,7 @@ kde.package rec { # TODO: ggz - postInstall = - '' - wrapPythonPrograms - ''; + postInstall = "wrapPythonPrograms"; meta = { description = "KDE Games"; diff --git a/pkgs/desktops/kde-4.7/pykde4.nix b/pkgs/desktops/kde-4.7/pykde4.nix index cca4e89279f2..2b5420f552ae 100644 --- a/pkgs/desktops/kde-4.7/pykde4.nix +++ b/pkgs/desktops/kde-4.7/pykde4.nix @@ -1,11 +1,11 @@ { kde, cmake, qt4, automoc4, kdelibs, phonon, python, sip, pyqt4 -, soprano, kdepimlibs, shared_desktop_ontologies, boost }: +, soprano, kdepimlibs, shared_desktop_ontologies, boost, lndir }: kde.package { buildInputs = [ cmake kdelibs qt4 automoc4 phonon python sip pyqt4 soprano - kdepimlibs shared_desktop_ontologies boost + kdepimlibs shared_desktop_ontologies boost lndir ]; NIX_CFLAGS_COMPILE = "-I${phonon}/include/phonon"; @@ -14,6 +14,12 @@ kde.package { '' substituteInPlace CMakeLists.txt \ --replace '{SIP_DEFAULT_SIP_DIR}' '{CMAKE_INSTALL_PREFIX}/share/sip' + + # Symlink PyQt into PyKDE. This is necessary because PyQt looks + # in its PyQt4/uic/widget-plugins directory for plugins, and KDE + # needs to install a plugin. + mkdir -p $out/lib/python2.7 + lndir ${pyqt4}/lib/python2.7 $out/lib/python2.7 ''; meta = { diff --git a/pkgs/development/python-modules/pyqt/default.nix b/pkgs/development/python-modules/pyqt/default.nix index 1f53b15d5f99..988599a04da9 100644 --- a/pkgs/development/python-modules/pyqt/default.nix +++ b/pkgs/development/python-modules/pyqt/default.nix @@ -9,6 +9,11 @@ stdenv.mkDerivation rec { }; configurePhase = '' + mkdir -p $out + lndir ${pythonDBus} $out + + export PYTHONPATH=$PYTHONPATH:$out/lib/${python.libPrefix}/site-packages + substituteInPlace configure.py \ --replace 'install_dir=pydbusmoddir' "install_dir='$out/lib/${python.libPrefix}/site-packages/dbus/mainloop'" @@ -16,18 +21,18 @@ stdenv.mkDerivation rec { --confirm-license --bindir $out/bin \ --destdir $out/lib/${python.libPrefix}/site-packages \ --plugin-destdir $out/lib/qt4/plugins --sipdir $out/share/sip \ - --dbus=${pythonDBus}/include/dbus-1.0 --verbose) + --dbus=$out/include/dbus-1.0 --verbose) python configure.py $configureFlags "''${configureFlagsArray[@]}" ''; - buildInputs = [ python pkgconfig makeWrapper qt4 ]; + buildInputs = [ python pkgconfig makeWrapper qt4 lndir ]; - propagatedBuildInputs = [ sip pythonDBus ]; + propagatedBuildInputs = [ sip ]; postInstall = '' for i in $out/bin/*; do - wrapProgram $i --prefix PYTHONPATH : $out/lib/${python.libPrefix}/site-packages:$PYTHONPATH + wrapProgram $i --prefix PYTHONPATH : "$PYTHONPATH" done ''; # */ diff --git a/pkgs/tools/misc/system-config-printer/default.nix b/pkgs/tools/misc/system-config-printer/default.nix index 92cc86eeef9c..a7a08f291872 100644 --- a/pkgs/tools/misc/system-config-printer/default.nix +++ b/pkgs/tools/misc/system-config-printer/default.nix @@ -2,6 +2,7 @@ , makeWrapper, pygobject, pygtk, docbook_xml_dtd_412, docbook_xsl , pythonDBus, libxml2, desktop_file_utils, libusb, cups, pycups , xz, pythonPackages +, withGUI ? true }: stdenv.mkDerivation rec { @@ -18,7 +19,9 @@ stdenv.mkDerivation rec { pythonPackages.python pythonPackages.wrapPython ]; - pythonPath = [ pythonDBus pycups pygtk pythonPackages.notify ]; + pythonPath = + [ pythonDBus pycups pygobject ] + ++ stdenv.lib.optionals withGUI [ pygtk pythonPackages.notify ]; configureFlags = "--with-udev-rules";