diff --git a/doc/packages/index.md b/doc/packages/index.md index 1f45018ffc4a..38dba5b3498f 100644 --- a/doc/packages/index.md +++ b/doc/packages/index.md @@ -14,6 +14,7 @@ fish.section.md fuse.section.md ibus.section.md kakoune.section.md +krita.section.md linux.section.md locales.section.md etc-files.section.md diff --git a/doc/packages/krita.section.md b/doc/packages/krita.section.md new file mode 100644 index 000000000000..ba427bd62ba1 --- /dev/null +++ b/doc/packages/krita.section.md @@ -0,0 +1,37 @@ +# Krita {#sec-krita} + +## Python plugins {#krita-python-plugins} + +"pykrita" plugins should be installed following +[Krita's manual](https://docs.krita.org/en/user_manual/python_scripting/install_custom_python_plugin.html). +This generally involves extracting the extension to `~/.local/share/krita/pykrita/`. + +## Binary plugins {#krita-binary-plugins} + +Binary plugins are Dynamically Linked Libraries to be loaded by Krita. + +_Note: You most likely won't need to deal with binary plugins, +all known plugins are bundled and enabled by default._ + +### Installing binary plugins {#krita-install-binary-plugins} + +You can choose what plugins are added to Krita by overriding the +`binaryPlugins` attribute. + +If you want to add plugins instead of replacing, you can read the +list of previous plugins via `pkgs.krita.binaryPlugins`: + +```nix +(pkgs.krita.override (old: { + binaryPlugins = old.binaryPlugins ++ [ your-plugin ]; +})) +``` + +### Example structure of a binary plugin {#krita-binary-plugin-structure} + +``` +/nix/store/00000000000000000000000000000000-krita-plugin-example-1.2.3 +└── lib + └── kritaplugins + └── krita_example.so +``` diff --git a/pkgs/applications/graphics/krita/generic.nix b/pkgs/applications/graphics/krita/generic.nix index 9416a4708e4c..8df637ffa1ce 100644 --- a/pkgs/applications/graphics/krita/generic.nix +++ b/pkgs/applications/graphics/krita/generic.nix @@ -1,4 +1,4 @@ -{ mkDerivation, lib, stdenv, fetchpatch, makeWrapper, fetchurl, cmake, extra-cmake-modules +{ mkDerivation, lib, stdenv, fetchpatch, fetchurl, cmake, extra-cmake-modules , karchive, kconfig, kwidgetsaddons, kcompletion, kcoreaddons , kguiaddons, ki18n, kitemmodels, kitemviews, kwindowsystem , kio, kcrash, breeze-icons @@ -13,7 +13,7 @@ }: mkDerivation rec { - pname = "krita"; + pname = "krita-unwrapped"; inherit version; src = fetchurl { @@ -36,7 +36,7 @@ mkDerivation rec { }) ]; - nativeBuildInputs = [ cmake extra-cmake-modules pkg-config python3Packages.sip makeWrapper ]; + nativeBuildInputs = [ cmake extra-cmake-modules pkg-config python3Packages.sip ]; buildInputs = [ karchive kconfig kwidgetsaddons kcompletion kcoreaddons kguiaddons @@ -72,14 +72,11 @@ mkDerivation rec { "-DBUILD_KRITA_QT_DESIGNER_PLUGINS=ON" ]; - preInstall = '' - qtWrapperArgs+=(--prefix PYTHONPATH : "$PYTHONPATH") - ''; - meta = with lib; { description = "A free and open source painting application"; homepage = "https://krita.org/"; maintainers = with maintainers; [ abbradar sifmelcara nek0 ]; + mainProgram = "krita"; platforms = platforms.linux; license = licenses.gpl3Only; }; diff --git a/pkgs/applications/graphics/krita/wrapper.nix b/pkgs/applications/graphics/krita/wrapper.nix new file mode 100644 index 000000000000..6d62412e5662 --- /dev/null +++ b/pkgs/applications/graphics/krita/wrapper.nix @@ -0,0 +1,27 @@ +{ lib +, libsForQt5 +, symlinkJoin +, unwrapped ? libsForQt5.callPackage ./. { } +, krita-plugin-gmic +, binaryPlugins ? [ + # Default plugins provided by upstream appimage + krita-plugin-gmic + ] +}: + +symlinkJoin { + name = lib.replaceStrings [ "-unwrapped" ] [ "" ] unwrapped.name; + inherit (unwrapped) version buildInputs nativeBuildInputs meta; + + paths = [ unwrapped ] ++ binaryPlugins; + + postBuild = '' + wrapQtApp "$out/bin/krita" \ + --prefix PYTHONPATH : "$PYTHONPATH" \ + --set KRITA_PLUGIN_PATH "$out/lib/kritaplugins" + ''; + + passthru = { + inherit unwrapped binaryPlugins; + }; +} diff --git a/pkgs/by-name/kr/krita-plugin-gmic/package.nix b/pkgs/by-name/kr/krita-plugin-gmic/package.nix new file mode 100644 index 000000000000..4cd46efd083a --- /dev/null +++ b/pkgs/by-name/kr/krita-plugin-gmic/package.nix @@ -0,0 +1,51 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, extra-cmake-modules +, fftw +, krita +, libsForQt5 +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "krita-plugin-gmic"; + version = "3.2.4.1"; + + src = fetchFromGitHub { + owner = "amyspark"; + repo = "gmic"; + rev = "v${finalAttrs.version}"; + hash = "sha256-SYE8kGvN7iD5OqiEEZpB/eRle67PrB5DojMC79qAQtg="; + }; + sourceRoot = "${finalAttrs.src.name}/gmic-qt"; + dontWrapQtApps = true; + + postPatch = '' + patchShebangs \ + translations/filters/csv2ts.sh \ + translations/lrelease.sh + ''; + + nativeBuildInputs = [ cmake extra-cmake-modules ]; + + buildInputs = [ + fftw + krita.unwrapped + libsForQt5.kcoreaddons + libsForQt5.qttools + ]; + + cmakeFlags = [ + (lib.cmakeFeature "GMIC_QT_HOST" "krita-plugin") + # build krita's gmic instead of using the one from nixpkgs + (lib.cmakeBool "ENABLE_SYSTEM_GMIC" false) + ]; + + meta = with lib; { + homepage = "https://github.com/amyspark/gmic"; + description = "GMic plugin for Krita"; + license = lib.licenses.cecill21; + maintainers = with maintainers; [ lelgenio ]; + }; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 64ca3ab8b034..e4a55267f906 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -32491,7 +32491,7 @@ with pkgs; krane = callPackage ../applications/networking/cluster/krane { }; - krita = libsForQt5.callPackage ../applications/graphics/krita { }; + krita = callPackage ../applications/graphics/krita/wrapper.nix { }; ksuperkey = callPackage ../tools/X11/ksuperkey { };