Merge pull request #285177 from lelgenio/krita-plugin-gmic-package

krita: wrap with plugins, krita-plugin-gmic init at 3.2.4.1
This commit is contained in:
Peder Bergebakken Sundt 2024-04-07 21:42:25 +02:00 committed by GitHub
commit 0e4bf5608f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 121 additions and 8 deletions

View file

@ -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

View file

@ -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
```

View file

@ -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;
};

View file

@ -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;
};
}

View file

@ -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 ];
};
})

View file

@ -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 { };