2019-09-07 10:33:56 +00:00
|
|
|
{ lib
|
2023-05-03 01:23:58 +00:00
|
|
|
, cimg
|
2019-09-07 10:22:02 +00:00
|
|
|
, cmake
|
2023-05-23 23:49:21 +00:00
|
|
|
, coreutils
|
2023-05-03 01:23:58 +00:00
|
|
|
, curl
|
2024-03-09 15:48:42 +00:00
|
|
|
, fetchzip
|
2019-09-07 10:22:02 +00:00
|
|
|
, fftw
|
2023-05-03 01:23:58 +00:00
|
|
|
, gimp
|
|
|
|
, gimpPlugins
|
|
|
|
, gmic
|
2023-05-23 23:49:21 +00:00
|
|
|
, gnugrep
|
|
|
|
, gnused
|
2023-05-03 01:23:58 +00:00
|
|
|
, graphicsmagick
|
2019-09-07 10:22:02 +00:00
|
|
|
, libjpeg
|
|
|
|
, libpng
|
2024-03-09 15:48:42 +00:00
|
|
|
, libsForQt5
|
2023-05-03 01:23:58 +00:00
|
|
|
, libtiff
|
|
|
|
, ninja
|
2023-05-23 23:49:21 +00:00
|
|
|
, nix-update
|
2023-05-03 01:23:58 +00:00
|
|
|
, openexr
|
|
|
|
, pkg-config
|
2024-03-09 15:48:42 +00:00
|
|
|
, stdenv
|
2023-05-23 23:49:21 +00:00
|
|
|
, writeShellScript
|
2023-05-03 01:23:58 +00:00
|
|
|
, zlib
|
|
|
|
, variant ? "standalone"
|
2019-09-07 10:22:02 +00:00
|
|
|
}:
|
2018-09-27 17:28:23 +00:00
|
|
|
|
|
|
|
let
|
2019-09-07 10:33:56 +00:00
|
|
|
variants = {
|
|
|
|
gimp = {
|
|
|
|
extraDeps = [
|
|
|
|
gimp
|
|
|
|
gimp.gtk
|
|
|
|
];
|
|
|
|
description = "GIMP plugin for the G'MIC image processing framework";
|
|
|
|
};
|
|
|
|
|
|
|
|
standalone = {
|
2024-03-09 15:48:42 +00:00
|
|
|
extraDeps = []; # Just to keep uniformity and avoid test-for-null
|
2019-09-07 10:33:56 +00:00
|
|
|
description = "Versatile front-end to the image processing framework G'MIC";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
2023-05-03 01:23:58 +00:00
|
|
|
assert lib.assertMsg
|
|
|
|
(builtins.hasAttr variant variants)
|
|
|
|
"gmic-qt variant \"${variant}\" is not supported. Please use one of ${lib.concatStringsSep ", " (builtins.attrNames variants)}.";
|
2019-09-07 10:33:56 +00:00
|
|
|
|
2023-05-03 01:23:58 +00:00
|
|
|
assert lib.assertMsg
|
2024-03-09 15:48:42 +00:00
|
|
|
(builtins.all (d: d != null) variants.${variant}.extraDeps)
|
2023-05-03 01:23:58 +00:00
|
|
|
"gmic-qt variant \"${variant}\" is missing one of its dependencies.";
|
2019-09-07 10:33:56 +00:00
|
|
|
|
2023-05-03 01:23:58 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2021-01-24 09:19:10 +00:00
|
|
|
pname = "gmic-qt${lib.optionalString (variant != "standalone") "-${variant}"}";
|
2024-03-08 22:15:19 +00:00
|
|
|
version = "3.3.4";
|
2018-09-27 17:28:23 +00:00
|
|
|
|
2023-02-26 12:13:09 +00:00
|
|
|
src = fetchzip {
|
2023-05-03 01:23:58 +00:00
|
|
|
url = "https://gmic.eu/files/source/gmic_${finalAttrs.version}.tar.gz";
|
2024-03-08 22:15:19 +00:00
|
|
|
hash = "sha256-/Hh5yzH//i01kyeoqETokvsKUOcY2iZsiYJBEmgw1rU=";
|
2018-09-27 20:41:26 +00:00
|
|
|
};
|
2018-09-27 17:28:23 +00:00
|
|
|
|
2024-03-09 15:48:42 +00:00
|
|
|
sourceRoot = "${finalAttrs.src.name}/gmic-qt";
|
|
|
|
|
2019-09-07 10:22:02 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2024-03-09 15:48:42 +00:00
|
|
|
libsForQt5.wrapQtAppsHook
|
2022-06-29 19:34:35 +00:00
|
|
|
ninja
|
2024-03-09 15:48:42 +00:00
|
|
|
pkg-config
|
2019-09-07 10:22:02 +00:00
|
|
|
];
|
2018-09-27 17:28:23 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
2024-03-09 15:48:42 +00:00
|
|
|
curl
|
2019-09-07 10:22:02 +00:00
|
|
|
fftw
|
2024-03-09 15:48:42 +00:00
|
|
|
gmic
|
|
|
|
graphicsmagick
|
2019-09-07 10:22:02 +00:00
|
|
|
libjpeg
|
|
|
|
libpng
|
2024-03-09 15:48:42 +00:00
|
|
|
libtiff
|
2019-09-07 10:22:02 +00:00
|
|
|
openexr
|
2024-03-09 15:48:42 +00:00
|
|
|
zlib
|
|
|
|
] ++ (with libsForQt5; [
|
|
|
|
qtbase
|
|
|
|
qttools
|
|
|
|
]) ++ variants.${variant}.extraDeps;
|
2018-09-27 17:28:23 +00:00
|
|
|
|
2022-06-29 19:34:35 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs \
|
|
|
|
translations/filters/csv2ts.sh \
|
|
|
|
translations/lrelease.sh
|
2021-12-31 06:05:51 +00:00
|
|
|
'';
|
|
|
|
|
2023-05-03 01:23:58 +00:00
|
|
|
cmakeFlags = [
|
2023-09-25 21:13:40 +00:00
|
|
|
(lib.cmakeBool "ENABLE_DYNAMIC_LINKING" true)
|
2024-03-09 15:48:42 +00:00
|
|
|
(lib.cmakeBool "ENABLE_SYSTEM_GMIC" true)
|
|
|
|
(lib.cmakeFeature "GMIC_QT_HOST" (if variant == "standalone" then "none" else variant))
|
2023-05-03 01:23:58 +00:00
|
|
|
];
|
|
|
|
|
2019-09-07 10:33:56 +00:00
|
|
|
postFixup = lib.optionalString (variant == "gimp") ''
|
2021-12-31 06:11:12 +00:00
|
|
|
echo "wrapping $out/${gimp.targetPluginDir}/gmic_gimp_qt/gmic_gimp_qt"
|
|
|
|
wrapQtApp "$out/${gimp.targetPluginDir}/gmic_gimp_qt/gmic_gimp_qt"
|
2018-09-27 17:28:23 +00:00
|
|
|
'';
|
|
|
|
|
2023-02-19 16:34:52 +00:00
|
|
|
passthru = {
|
2023-02-19 16:48:56 +00:00
|
|
|
tests = {
|
2024-03-09 15:48:42 +00:00
|
|
|
# They need to be update in lockstep.
|
2023-02-19 16:48:56 +00:00
|
|
|
gimp-plugin = gimpPlugins.gmic;
|
2023-05-03 01:23:58 +00:00
|
|
|
inherit cimg gmic;
|
2023-02-19 16:48:56 +00:00
|
|
|
};
|
|
|
|
|
2023-05-23 23:49:21 +00:00
|
|
|
updateScript = writeShellScript "gmic-qt-update-script" ''
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
export PATH="${lib.makeBinPath [ coreutils curl gnugrep gnused nix-update ]}:$PATH"
|
|
|
|
|
|
|
|
latestVersion=$(curl 'https://gmic.eu/files/source/' \
|
|
|
|
| grep -E 'gmic_[^"]+\.tar\.gz' \
|
|
|
|
| sed -E 's/.+<a href="gmic_([^"]+)\.tar\.gz".+/\1/g' \
|
|
|
|
| sort --numeric-sort --reverse | head -n1)
|
|
|
|
|
|
|
|
if [[ '${finalAttrs.version}' = "$latestVersion" ]]; then
|
|
|
|
echo "The new version same as the old version."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
nix-update --version "$latestVersion"
|
|
|
|
'';
|
2023-02-19 16:34:52 +00:00
|
|
|
};
|
|
|
|
|
2023-05-03 01:23:58 +00:00
|
|
|
meta = {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://gmic.eu/";
|
2023-05-03 01:23:58 +00:00
|
|
|
inherit (variants.${variant}) description;
|
|
|
|
license = lib.licenses.gpl3Plus;
|
2023-04-24 22:15:57 +00:00
|
|
|
mainProgram = "gmic_qt";
|
2024-03-09 15:48:42 +00:00
|
|
|
maintainers = with lib.maintainers; [ AndersonTorres lilyinstarlight ];
|
2023-09-25 21:13:40 +00:00
|
|
|
platforms = lib.platforms.unix;
|
2018-09-27 17:28:23 +00:00
|
|
|
};
|
2023-05-03 01:23:58 +00:00
|
|
|
})
|