-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
/
default.nix
200 lines (181 loc) · 4.32 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
{ stdenv
, lib
, fetchurl
, substituteAll
, autoreconfHook
, pkg-config
, intltool
, babl
, gegl
, gtk2
, glib
, gdk-pixbuf
, isocodes
, pango
, cairo
, freetype
, fontconfig
, lcms
, libpng
, libjpeg
, libjxl
, poppler
, poppler_data
, libtiff
, libmng
, librsvg
, libwmf
, zlib
, libzip
, ghostscript
, aalib
, shared-mime-info
, libexif
, gettext
, makeWrapper
, gtk-doc
, xorg
, glib-networking
, libmypaint
, gexiv2
, harfbuzz
, mypaint-brushes1
, libwebp
, libheif
, libgudev
, openexr
, desktopToDarwinBundle
, AppKit
, Cocoa
, gtk-mac-integration-gtk2
, withPython ? false
, python2
}:
let
python = python2.withPackages (pp: [ pp.pygtk ]);
in stdenv.mkDerivation (finalAttrs: {
pname = "gimp";
version = "2.10.38";
outputs = [ "out" "dev" ];
src = fetchurl {
url = "http://download.gimp.org/pub/gimp/v${lib.versions.majorMinor finalAttrs.version}/gimp-${finalAttrs.version}.tar.bz2";
sha256 = "sha256-UKhF7sEciDH+hmFweVD1uERuNfMO37ms+Y+FwRM/hW4=";
};
patches = [
# to remove compiler from the runtime closure, reference was retained via
# gimp --version --verbose output
(substituteAll {
src = ./remove-cc-reference.patch;
cc_version = stdenv.cc.cc.name;
})
# Use absolute paths instead of relying on PATH
# to make sure plug-ins are loaded by the correct interpreter.
./hardcode-plugin-interpreters.patch
];
nativeBuildInputs = [
autoreconfHook # hardcode-plugin-interpreters.patch changes Makefile.am
pkg-config
intltool
gettext
makeWrapper
gtk-doc
] ++ lib.optionals stdenv.isDarwin [
desktopToDarwinBundle
];
buildInputs = [
babl
gegl
gtk2
glib
gdk-pixbuf
pango
cairo
gexiv2
harfbuzz
isocodes
freetype
fontconfig
lcms
libpng
libjpeg
libjxl
poppler
poppler_data
libtiff
openexr
libmng
librsvg
libwmf
zlib
libzip
ghostscript
aalib
shared-mime-info
libwebp
libheif
libexif
xorg.libXpm
glib-networking
libmypaint
mypaint-brushes1
] ++ lib.optionals stdenv.isDarwin [
AppKit
Cocoa
gtk-mac-integration-gtk2
] ++ lib.optionals stdenv.isLinux [
libgudev
] ++ lib.optionals withPython [
python
# Duplicated here because python.withPackages does not expose the dev output with pkg-config files
python2.pkgs.pygtk
];
# needed by gimp-2.0.pc
propagatedBuildInputs = [
gegl
];
configureFlags = [
"--without-webkit" # old version is required
"--disable-check-update"
"--with-bug-report-url=https://github.com/NixOS/nixpkgs/issues/new"
"--with-icc-directory=/run/current-system/sw/share/color/icc"
# fix libdir in pc files (${exec_prefix} needs to be passed verbatim)
"--libdir=\${exec_prefix}/lib"
] ++ lib.optionals (!withPython) [
"--disable-python" # depends on Python2 which was EOLed on 2020-01-01
];
enableParallelBuilding = true;
doCheck = true;
env = {
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-DGDK_OSX_BIG_SUR=16";
# 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 = ''
wrapProgram $out/bin/gimp-${lib.versions.majorMinor finalAttrs.version} \
--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE"
'';
passthru = {
# The declarations for `gimp-with-plugins` wrapper,
# used for determining plug-in installation paths
majorVersion = "${lib.versions.major finalAttrs.version}.0";
targetLibDir = "lib/gimp/${finalAttrs.passthru.majorVersion}";
targetDataDir = "share/gimp/${finalAttrs.passthru.majorVersion}";
targetPluginDir = "${finalAttrs.passthru.targetLibDir}/plug-ins";
targetScriptDir = "${finalAttrs.passthru.targetDataDir}/scripts";
# probably its a good idea to use the same gtk in plugins ?
gtk = gtk2;
python2Support = withPython;
};
meta = with lib; {
description = "GNU Image Manipulation Program";
homepage = "https://www.gimp.org/";
maintainers = with maintainers; [ jtojnar ];
license = licenses.gpl3Plus;
platforms = platforms.unix;
mainProgram = "gimp";
};
})