about summary refs log tree commit diff
path: root/pkgs/applications/graphics
diff options
context:
space:
mode:
authormingchuan <ming@culpring.com>2022-05-23 19:13:11 +0800
committermingchuan <ming@culpring.com>2022-06-04 09:31:05 +0800
commit0c77eaeba4448c76251b57f62474b0977ed02c25 (patch)
treea6839c24b3e8eaeee84db6cb61bb761c436ac93b /pkgs/applications/graphics
parent36a116742ded785300809dfa25a7dba18e54f443 (diff)
krita: Fix python plugins, add missing dependencies
Builtin python plugins (e.g. ten brushes) was not working because krita
cannot find sip during build. (Upstream changed how this works in recent
versions)

libmypaint is for MyPaint brush engine introduced in
krita 5. Builtin mypaint brushes won't work without this dependency.

libwebp is for exporting to WebP format.
Diffstat (limited to 'pkgs/applications/graphics')
-rw-r--r--pkgs/applications/graphics/krita/generic.nix19
1 files changed, 15 insertions, 4 deletions
diff --git a/pkgs/applications/graphics/krita/generic.nix b/pkgs/applications/graphics/krita/generic.nix
index a0819a203e722..825e8882a5578 100644
--- a/pkgs/applications/graphics/krita/generic.nix
+++ b/pkgs/applications/graphics/krita/generic.nix
@@ -3,7 +3,7 @@
 , kguiaddons, ki18n, kitemmodels, kitemviews, kwindowsystem
 , kio, kcrash, breeze-icons
 , boost, libraw, fftw, eigen, exiv2, libheif, lcms2, gsl, openexr, giflib
-, openjpeg, opencolorio_1, vc, poppler, curl, ilmbase
+, openjpeg, opencolorio_1, vc, poppler, curl, ilmbase, libmypaint, libwebp
 , qtmultimedia, qtx11extras, quazip
 , python3Packages
 
@@ -23,13 +23,13 @@ mkDerivation rec {
     inherit sha256;
   };
 
-  nativeBuildInputs = [ cmake extra-cmake-modules python3Packages.sip_4 makeWrapper ];
+  nativeBuildInputs = [ cmake extra-cmake-modules python3Packages.sip makeWrapper ];
 
   buildInputs = [
     karchive kconfig kwidgetsaddons kcompletion kcoreaddons kguiaddons
     ki18n kitemmodels kitemviews kwindowsystem kio kcrash breeze-icons
     boost libraw fftw eigen exiv2 lcms2 gsl openexr libheif giflib
-    openjpeg opencolorio_1 poppler curl ilmbase
+    openjpeg opencolorio_1 poppler curl ilmbase libmypaint libwebp
     qtmultimedia qtx11extras quazip
     python3Packages.pyqt5
   ] ++ lib.optional stdenv.hostPlatform.isx86 vc;
@@ -37,6 +37,17 @@ mkDerivation rec {
   NIX_CFLAGS_COMPILE = [ "-I${ilmbase.dev}/include/OpenEXR" ]
     ++ lib.optional stdenv.cc.isGNU "-Wno-deprecated-copy";
 
+  # Krita runs custom python scripts in CMake with custom PYTHONPATH which krita determined in their CMake script.
+  # Patch the PYTHONPATH so python scripts can import sip successfully.
+  postPatch = let
+    pythonPath = python3Packages.makePythonPath (with python3Packages; [ sip setuptools ]);
+  in ''
+    substituteInPlace cmake/modules/FindSIP.cmake \
+      --replace 'PYTHONPATH=''${_sip_python_path}' 'PYTHONPATH=${pythonPath}'
+    substituteInPlace cmake/modules/SIPMacros.cmake \
+      --replace 'PYTHONPATH=''${_krita_python_path}' 'PYTHONPATH=${pythonPath}'
+  '';
+
   cmakeFlags = [
     "-DPYQT5_SIP_DIR=${python3Packages.pyqt5}/${python3Packages.python.sitePackages}/PyQt5/bindings"
     "-DPYQT_SIP_DIR_OVERRIDE=${python3Packages.pyqt5}/${python3Packages.python.sitePackages}/PyQt5/bindings"
@@ -52,7 +63,7 @@ mkDerivation rec {
   meta = with lib; {
     description = "A free and open source painting application";
     homepage = "https://krita.org/";
-    maintainers = with maintainers; [ abbradar ];
+    maintainers = with maintainers; [ abbradar sifmelcara ];
     platforms = platforms.linux;
     license = licenses.gpl3Only;
   };