1{ stdenv, fetchurl, unzip, makeWrapper, perl, ImageExifTool, JSON
2, coreutils, zip, imagemagick, pngcrush, lcms2, fbida
3}:
4
5# TODO: add optional dependencies (snippet from fgallery source):
6#
7# if(system("jpegoptim -V >/dev/null 2>&1")) {
8# $jpegoptim = 0;
9# }
10# if($facedet && system("facedetect -h >/dev/null 2>&1")) {
11# fatal("cannot run \"facedetect\" (see http://www.thregr.org/~wavexx/hacks/facedetect/)");
12
13stdenv.mkDerivation rec {
14 name = "fgallery-1.7";
15
16 src = fetchurl {
17 url = "http://www.thregr.org/~wavexx/software/fgallery/releases/${name}.zip";
18 sha256 = "1iix6p8viwnsq3zn9vg99sx20nmgk2p5als3j1lk914nz3anvai4";
19 };
20
21 buildInputs = [ unzip makeWrapper perl ImageExifTool JSON ];
22
23 installPhase = ''
24 mkdir -p "$out/bin"
25 mkdir -p "$out/share/fgallery"
26
27 cp -r * "$out/share/fgallery"
28 ln -s -r "$out/share/fgallery/fgallery" "$out/bin/fgallery"
29
30 # Don't preserve file attributes when copying files to output directories.
31 # (fgallery copies parts of itself to each output directory, and without
32 # this change the read-only nix store causes some bumps in the workflow.)
33 sed -i -e "s|'cp'|'cp', '--no-preserve=all'|g" "$out/share/fgallery/fgallery"
34
35 wrapProgram "$out/share/fgallery/fgallery" \
36 --set PERL5LIB "$PERL5LIB" \
37 --set PATH "${stdenv.lib.makeSearchPath "bin"
38 [ coreutils zip imagemagick pngcrush lcms2 fbida ]}"
39 '';
40
41 meta = with stdenv.lib; {
42 description = "Static photo gallery generator";
43 homepage = http://www.thregr.org/~wavexx/software/fgallery/;
44 license = licenses.gpl2;
45 platforms = platforms.all;
46 maintainers = [ maintainers.bjornfor ];
47 };
48}