48 , desktopToDarwinBundle
51 , gtk-mac-integration-gtk2
57 python = python2.withPackages (pp: [ pp.pygtk ]);
58 in stdenv.mkDerivation (finalAttrs: {
62 outputs = [ "out" "dev" ];
65 url = "http://download.gimp.org/pub/gimp/v${lib.versions.majorMinor finalAttrs.version}/gimp-${finalAttrs.version}.tar.bz2";
66 sha256 = "sha256-UKhF7sEciDH+hmFweVD1uERuNfMO37ms+Y+FwRM/hW4=";
70 # to remove compiler from the runtime closure, reference was retained via
71 # gimp --version --verbose output
73 src = ./remove-cc-reference.patch;
74 cc_version = stdenv.cc.cc.name;
77 # Use absolute paths instead of relying on PATH
78 # to make sure plug-ins are loaded by the correct interpreter.
79 ./hardcode-plugin-interpreters.patch
81 # GIMP queries libheif.pc for builtin encoder/decoder support to determine if AVIF/HEIC files are supported
82 # (see https://gitlab.gnome.org/GNOME/gimp/-/blob/a8b1173ca441283971ee48f4778e2ffd1cca7284/configure.ac?page=2#L1846-1852)
83 # These variables have been removed since libheif 1.18.0
84 # (see https://github.com/strukturag/libheif/commit/cf0d89c6e0809427427583290547a7757428cf5a)
85 # This has already been fixed for the upcoming GIMP 3, but the fix has not been backported to 2.x yet
86 # (see https://gitlab.gnome.org/GNOME/gimp/-/issues/9080)
87 ./force-enable-libheif.patch
91 autoreconfHook # hardcode-plugin-interpreters.patch changes Makefile.am
98 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
138 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
141 gtk-mac-integration-gtk2
142 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
144 ] ++ lib.optionals withPython [
146 # Duplicated here because python.withPackages does not expose the dev output with pkg-config files
150 # needed by gimp-2.0.pc
151 propagatedBuildInputs = [
156 "--without-webkit" # old version is required
157 "--disable-check-update"
158 "--with-bug-report-url=https://github.com/NixOS/nixpkgs/issues/new"
159 "--with-icc-directory=/run/current-system/sw/share/color/icc"
160 # fix libdir in pc files (${exec_prefix} needs to be passed verbatim)
161 "--libdir=\${exec_prefix}/lib"
162 ] ++ lib.optionals (!withPython) [
163 "--disable-python" # depends on Python2 which was EOLed on 2020-01-01
166 enableParallelBuilding = true;
171 NIX_CFLAGS_COMPILE = toString (
173 ++ lib.optionals stdenv.cc.isGNU [ "-Wno-error=incompatible-pointer-types" ]
174 ++ lib.optionals stdenv.hostPlatform.isDarwin [ "-DGDK_OSX_BIG_SUR=16" ]
177 # Check if librsvg was built with --disable-pixbuf-loader.
178 PKG_CONFIG_GDK_PIXBUF_2_0_GDK_PIXBUF_MODULEDIR = "${librsvg}/${gdk-pixbuf.moduleDir}";
182 # The check runs before glib-networking is registered
183 export GIO_EXTRA_MODULES="${glib-networking}/lib/gio/modules:$GIO_EXTRA_MODULES"
187 wrapProgram $out/bin/gimp-${lib.versions.majorMinor finalAttrs.version} \
188 --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE"
192 # The declarations for `gimp-with-plugins` wrapper,
193 # used for determining plug-in installation paths
194 majorVersion = "${lib.versions.major finalAttrs.version}.0";
195 targetLibDir = "lib/gimp/${finalAttrs.passthru.majorVersion}";
196 targetDataDir = "share/gimp/${finalAttrs.passthru.majorVersion}";
197 targetPluginDir = "${finalAttrs.passthru.targetLibDir}/plug-ins";
198 targetScriptDir = "${finalAttrs.passthru.targetDataDir}/scripts";
200 # probably its a good idea to use the same gtk in plugins ?
203 python2Support = withPython;
207 description = "GNU Image Manipulation Program";
208 homepage = "https://www.gimp.org/";
209 maintainers = with maintainers; [ jtojnar ];
210 license = licenses.gpl3Plus;
211 platforms = platforms.unix;
212 mainProgram = "gimp";