1# install these packages into your profile. Then add
2# ~/.nix-profile/gimp-version-plugins to your plugin list you can find at
3# preferences -> Folders -> Plug-ins
4# same applies for the scripts
5
6{ pkgs, gimp }:
7let
8 inherit (pkgs) stdenv fetchurl pkgconfig glib;
9 targetPluginDir = "$out/${gimp.name}-plugins";
10 targetScriptDir = "$out/${gimp.name}-scripts";
11 prefix = "plugin-gimp-";
12
13 pluginDerivation = a: stdenv.mkDerivation ({
14 prePhases = "extraLib";
15 extraLib = ''
16 installScripts(){
17 mkdir -p ${targetScriptDir};
18 for p in "$@"; do cp "$p" ${targetScriptDir}; done
19 }
20 installPlugins(){
21 mkdir -p ${targetPluginDir};
22 for p in "$@"; do cp "$p" ${targetPluginDir}; done
23 }
24 '';
25 }
26 // a
27 # don't call this gimp-* unless you want nix replace gimp by a plugin :-)
28 // { name = "${a.name}-${gimp.name}-plugin"; }
29 );
30
31 scriptDerivation = {name, src} : pluginDerivation {
32 inherit name; phases = "extraLib installPhase";
33 installPhase = "installScripts ${src}";
34 };
35
36 libLQR = pluginDerivation {
37 name = "liblqr-1-0.4.1";
38 # required by lqrPlugin, you don't havet to install this lib explicitely
39 buildInputs = [ gimp ] ++ gimp.nativeBuildInputs;
40 src = fetchurl {
41 url = http://registry.gimp.org/files/liblqr-1-0.4.1.tar.bz2;
42 sha256 = "02g90wag7xi5rjlmwq8h0qs666b1i2sa90s4303hmym40il33nlz";
43 };
44 };
45
46in
47rec {
48 gap = pluginDerivation {
49 /* menu:
50 Video
51 */
52 name = "gap-2.6.0";
53 buildInputs = [ gimp pkgconfig glib pkgs.intltool gimp.gtk ] ++ gimp.nativeBuildInputs;
54 src = fetchurl {
55 url = ftp://ftp.gimp.org/pub/gimp/plug-ins/v2.6/gap/gimp-gap-2.6.0.tar.bz2;
56 sha256 = "1jic7ixcmsn4kx2cn32nc5087rk6g8xsrz022xy11yfmgvhzb0ql";
57 };
58 patchPhase = ''
59 sed -e 's,^\(GIMP_PLUGIN_DIR=\).*,\1'"$out/${gimp.name}-plugins", \
60 -e 's,^\(GIMP_DATA_DIR=\).*,\1'"$out/share/${gimp.name}", -i configure
61 '';
62 meta = with stdenv.lib; {
63 description = "The GIMP Animation Package";
64 homepage = http://www.gimp.org;
65 # The main code is given in GPLv3, but it has ffmpeg in it, and I think ffmpeg license
66 # falls inside "free".
67 license = with licenses; [ gpl3 free ];
68 };
69 };
70
71 fourier = pluginDerivation rec {
72 /* menu:
73 Filters/Generic/FFT Forward
74 Filters/Generic/FFT Inverse
75 */
76 name = "fourier-0.4.1";
77 buildInputs = [ gimp pkgs.fftw pkgconfig glib] ++ gimp.nativeBuildInputs;
78 postInstall = "fail";
79 installPhase = "installPlugins fourier";
80 src = fetchurl {
81 url = "http://registry.gimp.org/files/${name}.tar.gz";
82 sha256 = "1pr3y3zl9w8xs1circdrxpr98myz9m8wfzy022al79z4pdanwvs1";
83 };
84 };
85
86 focusblur = pluginDerivation rec {
87 /* menu:
88 Blur/Focus Blur
89 */
90 name = "focusblur-3.2.6";
91 buildInputs = [ gimp pkgconfig pkgs.fftwSinglePrec ] ++ gimp.nativeBuildInputs;
92 patches = [ ./patches/focusblur-glib.patch ];
93 postInstall = "fail";
94 installPhase = "installPlugins src/focusblur";
95 src = fetchurl {
96 url = "http://registry.gimp.org/files/${name}.tar.bz2";
97 sha256 = "1gqf3hchz7n7v5kpqkhqh8kwnxbsvlb5cr2w2n7ngrvl56f5xs1h";
98 };
99 };
100
101 resynthesizer = pluginDerivation {
102 /* menu:
103 Filters/Map/Resynthesize
104 Filters/Enhance/Smart enlarge
105 Filters/Enhance/Smart sharpen
106 Filters/Enhance/Smart remove selection
107 */
108 name = "resynthesizer-0.16";
109 buildInputs = [ gimp pkgs.fftw ] ++ gimp.nativeBuildInputs;
110 src = fetchurl {
111 url = http://www.logarithmic.net/pfh-files/resynthesizer/resynthesizer-0.16.tar.gz;
112 sha256 = "1k90a1jzswxmajn56rdxa4r60v9v34fmqsiwfdxqcvx3yf4yq96x";
113 };
114
115 installPhase = "
116 installPlugins resynth
117 installScripts smart-{enlarge,remove}.scm
118 ";
119 };
120
121 texturize = pluginDerivation {
122 name = "texturize-2.1";
123 buildInputs = [ gimp ] ++ gimp.nativeBuildInputs;
124 src = fetchurl {
125 url = mirror://sourceforge/gimp-texturize/texturize-2.1_src.tgz;
126 sha256 = "0cdjq25g3yfxx6bzx6nid21kq659s1vl9id4wxyjs2dhcv229cg3";
127 };
128 patchPhase = ''
129 sed -i '/.*gimpimage_pdb.h.*/ d' src/*.c*
130 '';
131 installPhase = "installPlugins src/texturize";
132 };
133
134 waveletSharpen = pluginDerivation {
135 /* menu:
136 Filters/Enhance/Wavelet sharpen
137 */
138 name = "wavelet-sharpen-0.1.2";
139 buildInputs = [ gimp ] ++ gimp.nativeBuildInputs;
140 src = fetchurl {
141 url = http://registry.gimp.org/files/wavelet-sharpen-0.1.2.tar.gz;
142 sha256 = "0vql1k67i21g5ivaa1jh56rg427m0icrkpryrhg75nscpirfxxqw";
143 };
144 installPhase = "installPlugins src/wavelet-sharpen"; # TODO translations are not copied .. How to do this on nix?
145 };
146
147 lqrPlugin = pluginDerivation {
148 /* menu:
149 Layer/Liquid Rescale
150 */
151 name = "lqr-plugin-0.6.1";
152 buildInputs = [ pkgconfig libLQR gimp ] ++ gimp.nativeBuildInputs;
153 src = fetchurl {
154 url = http://registry.gimp.org/files/gimp-lqr-plugin-0.6.1.tar.bz2;
155 sha256 = "00hklkpcimcbpjly4rjhfipaw096cpy768g9wixglwrsyqhil7l9";
156 };
157 #postInstall = ''mkdir -p $out/nix-support; echo "${libLQR}" > "$out/nix-support/propagated-user-env-packages"'';
158 installPhase = "installPlugins src/gimp-lqr-plugin";
159 };
160
161 gmic =
162 pluginDerivation rec {
163 name = "gmic-1.6.5.0";
164
165 buildInputs = [pkgconfig pkgs.fftw pkgs.opencv gimp] ++ gimp.nativeBuildInputs;
166
167 src = fetchurl {
168 url = http://gmic.eu/files/source/gmic_1.6.5.0.tar.gz;
169 sha256 = "1vb6zm5zpqfnzxjvb9yfvczaqacm55rf010ib0yk9f28b17qrjgb";
170 };
171
172 sourceRoot = "${name}/src";
173
174 buildFlags = "gimp";
175
176 installPhase = "installPlugins gmic_gimp";
177
178 meta = {
179 description = "script language for image processing which comes with its open-source interpreter";
180 homepage = http://gmic.eu/gimp.shtml;
181 license = stdenv.lib.licenses.cecill20;
182 /*
183 The purpose of this Free Software license agreement is to grant users
184 the right to modify and redistribute the software governed by this
185 license within the framework of an open source distribution model.
186 [ ... ] */
187 };
188 };
189
190 # this is more than a gimp plugin !
191 # either load the raw image with gimp (and the import dialog will popup)
192 # or use the binary
193 ufraw = pluginDerivation rec {
194 name = "ufraw-0.19.2";
195 buildInputs = [pkgs.gtkimageview pkgs.lcms gimp] ++ gimp.nativeBuildInputs;
196 # --enable-mime - install mime files, see README for more information
197 # --enable-extras - build extra (dcraw, nikon-curve) executables
198 # --enable-dst-correction - enable DST correction for file timestamps.
199 # --enable-contrast - enable the contrast setting option.
200 # --enable-interp-none: enable 'None' interpolation (mostly for debugging).
201 # --with-lensfun: use the lensfun library - experimental feature, read this before using it.
202 # --with-prefix=PREFIX - use also PREFIX as an input prefix for the build
203 # --with-dosprefix=PREFIX - PREFIX in the the prefix in dos format (needed only for ms-window
204 configureFlags = "--enable-extras --enable-dst-correction --enable-contrast";
205
206 src = fetchurl {
207 url = "mirror://sourceforge/ufraw/${name}.tar.gz";
208 sha256 = "1lxba7pb3vcsq94dwapg9bk9mb3ww6r3pvvcyb0ah5gh2sgzxgkk";
209 };
210 installPhase = "
211 installPlugins ufraw-gimp
212 mkdir -p $out/bin
213 cp ufraw $out/bin
214 ";
215 };
216
217 gimplensfun = pluginDerivation rec {
218 name = "gimplensfun-0.1.1";
219
220 src = fetchurl {
221 url = "http://lensfun.sebastiankraft.net/${name}.tar.gz";
222 sha256 = "0kr296n4k7gsjqg1abmvpysxi88iq5wrzdpcg7vm7l1ifvbs972q";
223 };
224
225 patchPhase = '' sed -i Makefile -e's|/usr/bin/g++|g++|' '';
226
227 buildInputs = [ gimp pkgconfig glib gimp.gtk pkgs.lensfun pkgs.exiv2 ];
228
229 installPhase = "
230 installPlugins gimplensfun
231 mkdir -p $out/bin
232 cp gimplensfun $out/bin
233 ";
234
235 meta = {
236 description = "GIMP plugin to correct lens distortion using the lensfun library and database";
237
238 homepage = http://lensfun.sebastiankraft.net/;
239
240 license = stdenv.lib.licenses.gpl3Plus;
241 maintainers = [ ];
242 platforms = stdenv.lib.platforms.gnu;
243 };
244 };
245
246 /* =============== simple script files ==================== */
247
248 # also have a look at enblend-enfuse in all-packages.nix
249 exposureBlend = scriptDerivation {
250 name = "exposure-blend";
251 src = fetchurl {
252 url = http://tir.astro.utoledo.edu/jdsmith/code/eb/exposure-blend.scm;
253 sha256 = "1b6c9wzpklqras4wwsyw3y3jp6fjmhnnskqiwm5sabs8djknfxla";
254 };
255 };
256
257 lightning = scriptDerivation {
258 name = "Lightning";
259 src = fetchurl {
260 url = http://registry.gimp.org/files/Lightning.scm;
261 sha256 = "c14a8f4f709695ede3f77348728a25b3f3ded420da60f3f8de3944b7eae98a49";
262 };
263 };
264
265 /* space in name trouble ?
266
267 rainbowPlasma = scriptDerivation {
268 # http://registry.gimp.org/node/164
269 name = "rainbow-plasma";
270 src = fetchurl {
271 url = "http://registry.gimp.org/files/Rainbow Plasma.scm";
272 sha256 = "34308d4c9441f9e7bafa118af7ec9540f10ea0df75e812e2f3aa3fd7b5344c23";
273 name = "Rainbow-Plasma.scm"; # nix doesn't like spaces, does it?
274 };
275 };
276 */
277
278 /* doesn't seem to be working :-(
279 lightningGate = scriptDerivation {
280 # http://registry.gimp.org/node/153
281 name = "lightning-gate";
282 src = fetchurl {
283 url = http://registry.gimp.org/files/LightningGate.scm;
284 sha256 = "181w1zi9a99kn2mfxjp43wkwcgw5vbb6iqjas7a9mhm8p04csys2";
285 };
286 };
287 */
288
289}