summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/applications/graphics/gimp/2.8.nix57
-rw-r--r--pkgs/applications/graphics/gimp/default.nix95
-rw-r--r--pkgs/applications/graphics/gimp/plugins/default.nix63
-rw-r--r--pkgs/applications/graphics/gimp/wrapper.nix7
-rw-r--r--pkgs/applications/graphics/sane/xsane.nix6
-rw-r--r--pkgs/applications/graphics/ufraw/default.nix24
-rw-r--r--pkgs/development/libraries/gdk-pixbuf/default.nix3
-rw-r--r--pkgs/development/libraries/gegl/4.0.nix38
-rw-r--r--pkgs/development/libraries/mypaint-brushes/default.nix35
-rw-r--r--pkgs/tools/graphics/gmic/default.nix51
-rw-r--r--pkgs/top-level/all-packages.nix14
11 files changed, 247 insertions, 146 deletions
diff --git a/pkgs/applications/graphics/gimp/2.8.nix b/pkgs/applications/graphics/gimp/2.8.nix
deleted file mode 100644
index 3802fff2ad21..000000000000
--- a/pkgs/applications/graphics/gimp/2.8.nix
+++ /dev/null
@@ -1,57 +0,0 @@
-{ stdenv, fetchurl, pkgconfig, intltool, babl, gegl, gtk2, glib, gdk_pixbuf
-, pango, cairo, freetype, fontconfig, lcms, libpng, libjpeg, poppler, libtiff
-, webkit, libmng, librsvg, libwmf, zlib, libzip, ghostscript, aalib, jasper
-, python2Packages, libexif, gettext, xorg
-, AppKit, Cocoa, gtk-mac-integration }:
-
-let
-  inherit (python2Packages) pygtk wrapPython python;
-in stdenv.mkDerivation rec {
-  name = "gimp-${version}";
-  version = "2.8.22";
-
-  # This declarations for `gimp-with-plugins` wrapper,
-  # (used for determining $out/lib/gimp/${majorVersion}/ paths)
-  majorVersion = "2.0";
-  targetPluginDir = "$out/lib/gimp/${majorVersion}/plug-ins";
-  targetScriptDir = "$out/lib/gimp/${majorVersion}/scripts";
-
-  src = fetchurl {
-    url = "http://download.gimp.org/pub/gimp/v2.8/${name}.tar.bz2";
-    sha256 = "12k3lp938qdc9cqj29scg55f3bb8iav2fysd29w0s49bqmfa71wi";
-  };
-
-  buildInputs =
-    [ pkgconfig intltool babl gegl gtk2 glib gdk_pixbuf pango cairo
-      freetype fontconfig lcms libpng libjpeg poppler libtiff webkit
-      libmng librsvg libwmf zlib libzip ghostscript aalib jasper
-      python pygtk libexif gettext xorg.libXpm
-      wrapPython
-    ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ AppKit Cocoa gtk-mac-integration ];
-
-  pythonPath = [ pygtk ];
-
-  postFixup = ''
-    wrapPythonProgramsIn $out/lib/gimp/2.0/plug-ins/
-    wrapProgram $out/bin/gimp \
-      --prefix PYTHONPATH : "$PYTHONPATH" \
-      --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE"
-  '';
-
-  passthru = { gtk = gtk2; }; # probably its a good idea to use the same gtk in plugins ?
-
-  #configureFlags = [ "--disable-print" ];
-
-  enableParallelBuilding = true;
-
-  # "screenshot" needs this.
-  NIX_LDFLAGS = "-rpath ${xorg.libX11.out}/lib";
-
-  meta = {
-    description = "The GNU Image Manipulation Program";
-    homepage = https://www.gimp.org/;
-    license = stdenv.lib.licenses.gpl3Plus;
-    platforms = stdenv.lib.platforms.unix;
-  };
-}
diff --git a/pkgs/applications/graphics/gimp/default.nix b/pkgs/applications/graphics/gimp/default.nix
new file mode 100644
index 000000000000..2536367f6ceb
--- /dev/null
+++ b/pkgs/applications/graphics/gimp/default.nix
@@ -0,0 +1,95 @@
+{ stdenv, fetchurl, fetchpatch, autoreconfHook, pkgconfig, intltool, babl, gegl, gtk2, glib, gdk_pixbuf, isocodes
+, pango, cairo, freetype, fontconfig, lcms, libpng, libjpeg, poppler, poppler_data, libtiff
+, libmng, librsvg, libwmf, zlib, libzip, ghostscript, aalib, shared-mime-info
+, python2Packages, libexif, gettext, xorg, glib-networking, libmypaint, gexiv2
+, harfbuzz, mypaint-brushes, libwebp, libgudev, openexr
+, AppKit, Cocoa, gtk-mac-integration }:
+
+let
+  inherit (python2Packages) pygtk wrapPython python;
+in stdenv.mkDerivation rec {
+  name = "gimp-${version}";
+  version = "2.10.0";
+
+  src = fetchurl {
+    url = "http://download.gimp.org/pub/gimp/v${stdenv.lib.versions.majorMinor version}/${name}.tar.bz2";
+    sha256 = "1qkxaigbfkx26xym5nzrgfrmn97cbnhn63v1saaha2nbi3xrdk3z";
+  };
+
+  patches = [
+    # fix rpath of python library https://bugzilla.gnome.org/show_bug.cgi?id=795620
+    (fetchurl {
+      url = https://bugzilla.gnome.org/attachment.cgi?id=371482;
+      sha256 = "18bysndh61pvlv255xapdrfpsl5ivm51wp1w7xgk9vky9z2y3llc";
+    })
+
+    # fix absolute paths stored in configuration
+    (fetchpatch {
+      url = https://git.gnome.org/browse/gimp/patch/?id=0fce8fdb3c056acead8322c976a96fb6fba793b6;
+      sha256 = "09845i3bdpdbf13razr04ksvwydxcvzhjwlb4dfgdv5q203g2ris";
+    })
+    (fetchpatch {
+      url = https://git.gnome.org/browse/gimp/patch/?id=f6b586237cb8c912c1503f8e6086edd17f07d4df;
+      sha256 = "0s68885ip2wgjvsl5vqi2f1xhxdjpzqprifzgdl1vnv6gqmfy3bh";
+    })
+
+    # fix pc file (needed e.g. for building plug-ins)
+    (fetchpatch {
+      url = https://git.gnome.org/browse/gimp/patch/?id=7e19906827d301eb70275dba089849a632a0eabe;
+      sha256 = "0cbjfbwvzg2hqihg3rpsga405v7z2qahj22dfqn2jrb2gbhrjcp1";
+    })
+  ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig intltool gettext wrapPython ];
+  propagatedBuildInputs = [ gegl ]; # needed by gimp-2.0.pc
+  buildInputs = [
+    babl gegl gtk2 glib gdk_pixbuf pango cairo gexiv2 harfbuzz isocodes libgudev
+    freetype fontconfig lcms libpng libjpeg poppler poppler_data libtiff openexr
+    libmng librsvg libwmf zlib libzip ghostscript aalib shared-mime-info libwebp
+    python pygtk libexif xorg.libXpm glib-networking libmypaint mypaint-brushes
+  ] ++ stdenv.lib.optionals stdenv.isDarwin [ AppKit Cocoa gtk-mac-integration ];
+
+  pythonPath = [ pygtk ];
+
+  # Check if librsvg was built with --disable-pixbuf-loader.
+  PKG_CONFIG_GDK_PIXBUF_2_0_GDK_PIXBUF_MODULEDIR = "${librsvg}/${gdk_pixbuf.moduleDir}";
+
+  preConfigure = ''
+    # The check runs before glib-networking is registered
+    export GIO_EXTRA_MODULES="${glib-networking}/lib/gio/modules:$GIO_EXTRA_MODULES"
+  '';
+
+  postFixup = ''
+    wrapPythonProgramsIn $out/lib/gimp/${passthru.majorVersion}/plug-ins/
+    wrapProgram $out/bin/gimp-${stdenv.lib.versions.majorMinor version} \
+      --prefix PYTHONPATH : "$PYTHONPATH" \
+      --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE"
+  '';
+
+  passthru = rec {
+    # The declarations for `gimp-with-plugins` wrapper,
+    # used for determining plug-in installation paths
+    majorVersion = "${stdenv.lib.versions.major version}.0";
+    targetPluginDir = "lib/gimp/${majorVersion}/plug-ins";
+    targetScriptDir = "lib/gimp/${majorVersion}/scripts";
+
+    # probably its a good idea to use the same gtk in plugins ?
+    gtk = gtk2;
+  };
+
+  configureFlags = [
+    "--without-webkit" # old version is required
+  ];
+
+  doCheck = true;
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "The GNU Image Manipulation Program";
+    homepage = https://www.gimp.org/;
+    maintainers = with maintainers; [ jtojnar ];
+    license = licenses.gpl3Plus;
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/applications/graphics/gimp/plugins/default.nix b/pkgs/applications/graphics/gimp/plugins/default.nix
index 0d4215dd5bc2..f491f5dc914a 100644
--- a/pkgs/applications/graphics/gimp/plugins/default.nix
+++ b/pkgs/applications/graphics/gimp/plugins/default.nix
@@ -12,12 +12,12 @@ let
     prePhases = "extraLib";
     extraLib = ''
       installScripts(){
-        mkdir -p ${targetScriptDir};
-        for p in "$@"; do cp "$p" ${targetScriptDir}; done
+        mkdir -p $out/${targetScriptDir};
+        for p in "$@"; do cp "$p" $out/${targetScriptDir}; done
       }
       installPlugins(){
-        mkdir -p ${targetPluginDir};
-        for p in "$@"; do cp "$p" ${targetPluginDir}; done
+        mkdir -p $out/${targetPluginDir};
+        for p in "$@"; do cp "$p" $out/${targetPluginDir}; done
       }
     '';
   }
@@ -35,15 +35,6 @@ let
     installPhase = "installScripts ${src}";
   };
 
- libLQR = pluginDerivation {
-    name = "liblqr-1-0.4.1";
-    # required by lqrPlugin, you don't havet to install this lib explicitely
-    src = fetchurl {
-      url = http://registry.gimp.org/files/liblqr-1-0.4.1.tar.bz2;
-      sha256 = "02g90wag7xi5rjlmwq8h0qs666b1i2sa90s4303hmym40il33nlz";
-    };
-  };
-
 in
 rec {
   gap = pluginDerivation {
@@ -97,6 +88,7 @@ rec {
       url = "http://registry.gimp.org/files/${name}.tar.bz2";
       sha256 = "1gqf3hchz7n7v5kpqkhqh8kwnxbsvlb5cr2w2n7ngrvl56f5xs1h";
     };
+    meta.broken = true;
   };
 
   resynthesizer = pluginDerivation {
@@ -147,6 +139,7 @@ rec {
       sha256 = "1zzvbczly7k456c0y6s92a1i8ph4ywmbvdl8i4rcc29l4qd2z8fw";
     };
     installPhase = "installPlugins src/texturize";
+    meta.broken = true; # https://github.com/lmanul/gimp-texturize/issues/1
   };
 
   waveletSharpen = pluginDerivation {
@@ -166,54 +159,18 @@ rec {
        Layer/Liquid Rescale
     */
     name = "lqr-plugin-0.6.1";
-    buildInputs = with pkgs; [ libLQR ];
+    buildInputs = with pkgs; [ liblqr1 ];
     src = fetchurl {
       url = http://registry.gimp.org/files/gimp-lqr-plugin-0.6.1.tar.bz2;
       sha256 = "00hklkpcimcbpjly4rjhfipaw096cpy768g9wixglwrsyqhil7l9";
     };
-    #postInstall = ''mkdir -p $out/nix-support; echo "${libLQR}" > "$out/nix-support/propagated-user-env-packages"'';
+    #postInstall = ''mkdir -p $out/nix-support; echo "${liblqr1}" > "$out/nix-support/propagated-user-env-packages"'';
     installPhase = "installPlugins src/gimp-lqr-plugin";
   };
 
-  gmic =
-    pluginDerivation rec {
-      inherit (pkgs.gmic) name src meta;
+  gmic = pkgs.gmic.gimpPlugin;
 
-      buildInputs = with pkgs; [ fftw opencv curl ];
-
-      sourceRoot = "${name}/src";
-
-      buildFlags = "gimp";
-
-      installPhase = "installPlugins gmic_gimp";
-  };
-
-  # this is more than a gimp plugin !
-  # either load the raw image with gimp (and the import dialog will popup)
-  # or use the binary
-  ufraw = pluginDerivation rec {
-    name = "ufraw-0.19.2";
-    buildInputs = with pkgs; [ gtkimageview lcms ];
-      # --enable-mime - install mime files, see README for more information
-      # --enable-extras - build extra (dcraw, nikon-curve) executables
-      # --enable-dst-correction - enable DST correction for file timestamps.
-      # --enable-contrast - enable the contrast setting option.
-      # --enable-interp-none: enable 'None' interpolation (mostly for debugging).
-      # --with-lensfun: use the lensfun library - experimental feature, read this before using it.
-      # --with-prefix=PREFIX - use also PREFIX as an input prefix for the build
-      # --with-dosprefix=PREFIX - PREFIX in the the prefix in dos format (needed only for ms-window
-    configureFlags = "--enable-extras --enable-dst-correction --enable-contrast";
-
-    src = fetchurl {
-      url = "mirror://sourceforge/ufraw/${name}.tar.gz";
-      sha256 = "1lxba7pb3vcsq94dwapg9bk9mb3ww6r3pvvcyb0ah5gh2sgzxgkk";
-    };
-    installPhase = "
-      installPlugins ufraw-gimp
-      mkdir -p $out/bin
-      cp ufraw $out/bin
-    ";
-  };
+  ufraw = pkgs.ufraw.gimpPlugin;
 
   gimplensfun = pluginDerivation rec {
     version = "0.2.4";
diff --git a/pkgs/applications/graphics/gimp/wrapper.nix b/pkgs/applications/graphics/gimp/wrapper.nix
index 7455a69dde97..ec529519159b 100644
--- a/pkgs/applications/graphics/gimp/wrapper.nix
+++ b/pkgs/applications/graphics/gimp/wrapper.nix
@@ -1,9 +1,10 @@
 { stdenv, lib, symlinkJoin, gimp, makeWrapper, gimpPlugins, plugins ? null}:
 
 let
-allPlugins = lib.filter (pkg: builtins.isAttrs pkg && pkg.type == "derivation") (lib.attrValues gimpPlugins);
+allPlugins = lib.filter (pkg: builtins.isAttrs pkg && pkg.type == "derivation" && !pkg.meta.broken or false) (lib.attrValues gimpPlugins);
 selectedPlugins = if plugins == null then allPlugins else plugins;
 extraArgs = map (x: x.wrapArgs or "") selectedPlugins;
+versionBranch = stdenv.lib.versions.majorMinor gimp.version;
 
 in symlinkJoin {
   name = "gimp-with-plugins-${gimp.version}";
@@ -13,14 +14,14 @@ in symlinkJoin {
   buildInputs = [ makeWrapper ];
 
   postBuild = ''
-    for each in gimp-2.8 gimp-console-2.8; do
+    for each in gimp-${versionBranch} gimp-console-${versionBranch}; do
       wrapProgram $out/bin/$each \
         --set GIMP2_PLUGINDIR "$out/lib/gimp/2.0" \
         ${toString extraArgs}
     done
     set +x
     for each in gimp gimp-console; do
-      ln -sf "$each-2.8" $out/bin/$each
+      ln -sf "$each-${versionBranch}" $out/bin/$each
     done
   '';
 }
diff --git a/pkgs/applications/graphics/sane/xsane.nix b/pkgs/applications/graphics/sane/xsane.nix
index ad02e1a80231..ca0f49e0c948 100644
--- a/pkgs/applications/graphics/sane/xsane.nix
+++ b/pkgs/applications/graphics/sane/xsane.nix
@@ -1,9 +1,9 @@
 { stdenv, fetchurl, sane-backends, sane-frontends, libX11, gtk2, pkgconfig, libpng
 , libusb ? null
-, gimpSupport ? false, gimp_2_8 ? null
+, gimpSupport ? false, gimp ? null
 }:
 
-assert gimpSupport -> gimp_2_8 != null;
+assert gimpSupport -> gimp != null;
 
 stdenv.mkDerivation rec {
   name = "xsane-0.999";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [libpng sane-backends sane-frontends libX11 gtk2 ]
     ++ (if libusb != null then [libusb] else [])
-    ++ stdenv.lib.optional gimpSupport gimp_2_8;
+    ++ stdenv.lib.optional gimpSupport gimp;
 
   meta = {
     homepage = http://www.sane-project.org/;
diff --git a/pkgs/applications/graphics/ufraw/default.nix b/pkgs/applications/graphics/ufraw/default.nix
index fc8e7a62c2ba..cb1c37aefebf 100644
--- a/pkgs/applications/graphics/ufraw/default.nix
+++ b/pkgs/applications/graphics/ufraw/default.nix
@@ -1,6 +1,9 @@
 { fetchurl, stdenv, pkgconfig, gtk2, gettext, bzip2, zlib
+, withGimpPlugin ? true, gimp ? null
 , libjpeg, libtiff, cfitsio, exiv2, lcms2, gtkimageview, lensfun }:
 
+assert withGimpPlugin -> gimp != null;
+
 stdenv.mkDerivation rec {
   name = "ufraw-0.22";
 
@@ -10,10 +13,23 @@ stdenv.mkDerivation rec {
     sha256 = "0pm216pg0vr44gwz9vcvq3fsf8r5iayljhf5nis2mnw7wn6d5azp";
   };
 
-  buildInputs =
-    [ pkgconfig gtk2 gtkimageview gettext bzip2 zlib
-      libjpeg libtiff cfitsio exiv2 lcms2 lensfun
-    ];
+  outputs = [ "out" ] ++ stdenv.lib.optional withGimpPlugin "gimpPlugin";
+
+  nativeBuildInputs = [ pkgconfig gettext ];
+  buildInputs = [
+    gtk2 gtkimageview bzip2 zlib
+    libjpeg libtiff cfitsio exiv2 lcms2 lensfun
+  ] ++ stdenv.lib.optional withGimpPlugin gimp;
+
+  configureFlags = [
+    "--enable-extras"
+    "--enable-dst-correction"
+    "--enable-contrast"
+  ] ++ stdenv.lib.optional withGimpPlugin "--with-gimp";
+
+  postInstall = stdenv.lib.optionalString withGimpPlugin ''
+    moveToOutput "lib/gimp" "$gimpPlugin"
+  '';
 
   meta = {
     homepage = http://ufraw.sourceforge.net/;
diff --git a/pkgs/development/libraries/gdk-pixbuf/default.nix b/pkgs/development/libraries/gdk-pixbuf/default.nix
index 6bfa6bdc2fb9..069b78f6bcac 100644
--- a/pkgs/development/libraries/gdk-pixbuf/default.nix
+++ b/pkgs/development/libraries/gdk-pixbuf/default.nix
@@ -52,6 +52,9 @@ stdenv.mkDerivation rec {
       packageName = pname;
       attrPath = "gdk_pixbuf";
     };
+
+    # gdk_pixbuf_moduledir variable from gdk-pixbuf-2.0.pc
+    moduleDir = "lib/gdk-pixbuf-2.0/2.10.0/loaders";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/gegl/4.0.nix b/pkgs/development/libraries/gegl/4.0.nix
new file mode 100644
index 000000000000..a8e50945c3fd
--- /dev/null
+++ b/pkgs/development/libraries/gegl/4.0.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, pkgconfig, glib, babl, libpng, cairo, libjpeg, which
+, librsvg, pango, gtk, bzip2, json-glib, intltool, autoreconfHook, libraw
+, libwebp, gnome3, libintl }:
+
+let
+  version = "0.4.0";
+in stdenv.mkDerivation rec {
+  name = "gegl-${version}";
+
+  src = fetchurl {
+    url = "http://download.gimp.org/pub/gegl/${stdenv.lib.versions.majorMinor version}/${name}.tar.bz2";
+    sha256 = "1ighk4z8nlqrzyj8w97s140hzj59564l3xv6fpzbr97m1zx2nkfh";
+  };
+
+  # needs fonts otherwise, don't know how to pass them
+  configureFlags = [ "--disable-docs" ];
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  buildInputs = [
+    libpng cairo libjpeg librsvg pango gtk bzip2
+    libraw libwebp gnome3.gexiv2
+  ];
+
+  propagatedBuildInputs = [ glib json-glib babl ]; # for gegl-4.0.pc
+
+  nativeBuildInputs = [ pkgconfig intltool which autoreconfHook libintl ];
+
+  meta = with stdenv.lib; {
+    description = "Graph-based image processing framework";
+    homepage = http://www.gegl.org;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/development/libraries/mypaint-brushes/default.nix b/pkgs/development/libraries/mypaint-brushes/default.nix
new file mode 100644
index 000000000000..140dbcc937b5
--- /dev/null
+++ b/pkgs/development/libraries/mypaint-brushes/default.nix
@@ -0,0 +1,35 @@
+{stdenv, fetchpatch, autoconf, automake, fetchFromGitHub, pkgconfig}:
+
+let
+  pname = "mypaint-brushes";
+  version = "1.3.0";
+in stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "Jehan";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1iz89z6v2mp8j1lrf942k561s8311i3s34ap36wh4rybb2lq15m0";
+  };
+
+  nativeBuildInputs = [ autoconf automake pkgconfig ];
+
+  patches = [
+    # build with automake 1.16
+    (fetchpatch {
+      url = https://github.com/Jehan/mypaint-brushes/commit/1e9109dde3bffd416ed351c3f30ecd6ffd0ca2cd.patch;
+      sha256 = "0mi8rwbirl0ib22f2hz7kdlgi4hw8s3ab29b003dsshdyzn5iha9";
+    })
+  ];
+
+  preConfigure = "./autogen.sh";
+
+  meta = with stdenv.lib; {
+    homepage = http://mypaint.org/;
+    description = "Brushes used by MyPaint and other software using libmypaint.";
+    license = licenses.cc0;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/tools/graphics/gmic/default.nix b/pkgs/tools/graphics/gmic/default.nix
index a8c491b049ff..008f9af36852 100644
--- a/pkgs/tools/graphics/gmic/default.nix
+++ b/pkgs/tools/graphics/gmic/default.nix
@@ -1,36 +1,45 @@
-{ stdenv, fetchurl, fftw, zlib, libjpeg, libtiff, libpng, pkgconfig }:
+{ stdenv, fetchurl, fetchFromGitHub, cmake, ninja, pkgconfig
+, opencv, openexr, graphicsmagick, fftw, zlib, libjpeg, libtiff, libpng
+, withGimpPlugin ? true, gimp ? null}:
 
-stdenv.mkDerivation rec {
+assert withGimpPlugin -> gimp != null;
+
+let
+  version = "2.2.2";
+
+  # CMakeLists.txt is missing from the tarball and Makefile is terrible
+  CMakeLists = fetchurl {
+    url = "https://github.com/dtschump/gmic/raw/v.${version}/CMakeLists.txt";
+    sha256 = "0lv5jrg98cpbk13fl4xm7l4sk1axfz054q570bpi741w815d7cpg";
+  };
+in stdenv.mkDerivation rec {
   name = "gmic-${version}";
-  version = "2.2.1";
+
+  outputs = [ "out" "lib" "dev" "man" ] ++ stdenv.lib.optional withGimpPlugin "gimpPlugin";
 
   src = fetchurl {
     url = "http://gmic.eu/files/source/gmic_${version}.tar.gz";
-    sha256 = "0iac1zaix2zv1dfp45ca0wk9pj6k02gf8l1vmg820z8jd12pa19w";
+    sha256 = "0zqfj2ym5nn3ff93xh2wf9ayxqlznabbdi00xw4lm7vw3iwkzqnc";
   };
 
-  nativeBuildInputs = [ pkgconfig ];
+  nativeBuildInputs = [ cmake ninja pkgconfig ];
 
-  buildInputs = [ fftw zlib libjpeg libtiff libpng ];
+  buildInputs = [
+    fftw zlib libjpeg libtiff libpng opencv openexr graphicsmagick
+  ] ++ stdenv.lib.optionals withGimpPlugin [ gimp gimp.gtk ];
 
-  sourceRoot = "${name}/src";
+  cmakeFlags = [
+    "-DBUILD_LIB_STATIC=OFF"
+    "-DBUILD_PLUGIN=${if withGimpPlugin then "ON" else "OFF"}"
+    "-DENABLE_DYNAMIC_LINKING=ON"
+  ];
 
-  preBuild = ''
-    buildFlagsArray=( \
-      CURL_CFLAGS= CURL_LIBS= \
-      OPENEXR_CFLAGS= OPENEXR_LIBS= \
-      OPENCV_CFLAGS= OPENCV_LIBS= \
-      X11_CFLAGS="-Dcimg_display=0" X11_LIBS= \
-      cli \
-    )
+  postPatch = ''
+    cp ${CMakeLists} CMakeLists.txt
   '';
 
-  installPhase = ''
-    mkdir -p $out/bin
-    mkdir -p $out/share/man/man1
-
-    cp -v gmic $out/bin/
-    cp -v ../man/gmic.1.gz $out/share/man/man1/
+  preConfigure = stdenv.lib.optionalString withGimpPlugin ''
+    cmakeFlags="$cmakeFlags -DPLUGIN_INSTALL_PREFIX=$gimpPlugin/${gimp.targetPluginDir}"
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 3ba524aa722a..4366bd19a325 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -8949,6 +8949,10 @@ with pkgs;
     gtk = self.gtk2;
   };
 
+  gegl_0_4 = callPackage ../development/libraries/gegl/4.0.nix {
+    gtk = self.gtk2;
+  };
+
   geoclue = callPackage ../development/libraries/geoclue {};
 
   geoclue2 = callPackage ../development/libraries/geoclue/2.0.nix {};
@@ -15908,16 +15912,14 @@ with pkgs;
 
   ghq = gitAndTools.ghq;
 
-  gimp_2_8 = callPackage ../applications/graphics/gimp/2.8.nix {
-    webkit = null;
+  gimp = callPackage ../applications/graphics/gimp {
+    gegl = gegl_0_4;
     lcms = lcms2;
+    inherit (gnome3) gexiv2;
     inherit (darwin.apple_sdk.frameworks) AppKit Cocoa;
   };
 
-  gimp = gimp_2_8;
-
   gimp-with-plugins = callPackage ../applications/graphics/gimp/wrapper.nix {
-    gimp = gimp_2_8;
     plugins = null; # All packaged plugins enabled, if not explicit plugin list supplied
   };
 
@@ -17080,6 +17082,8 @@ with pkgs;
 
   mypaint = callPackage ../applications/graphics/mypaint { };
 
+  mypaint-brushes = callPackage ../development/libraries/mypaint-brushes { };
+
   mythtv = libsForQt5.callPackage ../applications/video/mythtv { };
 
   micro = callPackage ../applications/editors/micro { };