2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, mkDerivation
|
|
|
|
, variant ? "standalone"
|
2023-03-08 16:32:21 +00:00
|
|
|
, fetchzip
|
|
|
|
, fetchpatch
|
2020-04-24 23:36:52 +00:00
|
|
|
, cmake
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2022-07-14 12:49:19 +00:00
|
|
|
, ninja
|
2020-04-24 23:36:52 +00:00
|
|
|
, opencv3
|
|
|
|
, openexr
|
|
|
|
, graphicsmagick
|
|
|
|
, fftw
|
|
|
|
, zlib
|
|
|
|
, libjpeg
|
|
|
|
, libtiff
|
|
|
|
, libpng
|
|
|
|
, curl
|
|
|
|
, gimp ? null
|
2022-07-14 12:49:19 +00:00
|
|
|
, gmic
|
2020-04-24 23:36:52 +00:00
|
|
|
, qtbase
|
|
|
|
, qttools
|
2022-01-19 23:45:15 +00:00
|
|
|
, writeShellScript
|
|
|
|
, common-updater-scripts
|
|
|
|
, gnugrep
|
|
|
|
, gnused
|
|
|
|
, coreutils
|
|
|
|
, jq
|
2023-02-22 10:55:15 +00:00
|
|
|
, nix-update-script
|
|
|
|
, gimpPlugins
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
variants = {
|
|
|
|
gimp = {
|
|
|
|
extraDeps = [
|
|
|
|
gimp
|
|
|
|
gimp.gtk
|
|
|
|
];
|
|
|
|
description = "GIMP plugin for the G'MIC image processing framework";
|
|
|
|
};
|
|
|
|
|
|
|
|
standalone = {
|
|
|
|
description = "Versatile front-end to the image processing framework G'MIC";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
assert lib.assertMsg (builtins.hasAttr variant variants) "gmic-qt variant “${variant}” is not supported. Please use one of ${lib.concatStringsSep ", " (builtins.attrNames variants)}.";
|
|
|
|
|
|
|
|
assert lib.assertMsg (builtins.all (d: d != null) variants.${variant}.extraDeps or []) "gmic-qt variant “${variant}” is missing one of its dependencies.";
|
|
|
|
|
|
|
|
mkDerivation rec {
|
2021-02-05 17:12:51 +00:00
|
|
|
pname = "gmic-qt${lib.optionalString (variant != "standalone") "-${variant}"}";
|
2023-02-22 10:55:15 +00:00
|
|
|
version = "3.2.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-03-08 16:32:21 +00:00
|
|
|
src = fetchzip {
|
|
|
|
url = "https://gmic.eu/files/source/gmic_${version}.tar.gz";
|
|
|
|
hash = "sha256-2lMnn19FcFKnfIjSxOObqxIjqLMUoWgi0ADZBCBePY4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-03-08 16:32:21 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
name = "gmic-qt-3.2.1-fix-system-gmic.patch";
|
|
|
|
url = "https://github.com/c-koi/gmic-qt/commit/e8d7a3523753ff592da63b1d54edf0921c54fe53.patch";
|
|
|
|
hash = "sha256-kBFZo2qvod4pH3oK8gvnmw39x6eMH9zjr4mMcY74mFo=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
sourceRoot = "source/gmic-qt";
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2022-07-14 12:49:19 +00:00
|
|
|
ninja
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2022-07-14 12:49:19 +00:00
|
|
|
gmic
|
2020-04-24 23:36:52 +00:00
|
|
|
qtbase
|
|
|
|
qttools
|
|
|
|
fftw
|
|
|
|
zlib
|
|
|
|
libjpeg
|
|
|
|
libtiff
|
|
|
|
libpng
|
|
|
|
opencv3
|
|
|
|
openexr
|
|
|
|
graphicsmagick
|
|
|
|
curl
|
|
|
|
] ++ variants.${variant}.extraDeps or [];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DGMIC_QT_HOST=${if variant == "standalone" then "none" else variant}"
|
2023-03-08 16:32:21 +00:00
|
|
|
"-DENABLE_SYSTEM_GMIC=ON"
|
|
|
|
"-DENABLE_DYNAMIC_LINKING=ON"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs \
|
|
|
|
translations/filters/csv2ts.sh \
|
|
|
|
translations/lrelease.sh
|
2022-01-19 23:45:15 +00:00
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postFixup = lib.optionalString (variant == "gimp") ''
|
2022-01-19 23:45:15 +00:00
|
|
|
echo "wrapping $out/${gimp.targetPluginDir}/gmic_gimp_qt/gmic_gimp_qt"
|
|
|
|
wrapQtApp "$out/${gimp.targetPluginDir}/gmic_gimp_qt/gmic_gimp_qt"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-02-22 10:55:15 +00:00
|
|
|
passthru = {
|
|
|
|
tests = {
|
|
|
|
gimp-plugin = gimpPlugins.gmic;
|
|
|
|
};
|
|
|
|
|
|
|
|
updateScript = nix-update-script { };
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = variants.${variant}.description;
|
|
|
|
homepage = "http://gmic.eu/";
|
2022-01-19 23:45:15 +00:00
|
|
|
license = licenses.gpl3Plus;
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|