nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 unzip,
6 makeWrapper,
7 perlPackages,
8 coreutils,
9 zip,
10 imagemagick,
11 pngcrush,
12 lcms2,
13 facedetect,
14 fbida,
15}:
16
17# TODO: add optional dependencies (snippet from fgallery source):
18#
19# if(system("jpegoptim -V >/dev/null 2>&1")) {
20# $jpegoptim = 0;
21# }
22
23stdenv.mkDerivation (finalAttrs: {
24 pname = "fgallery";
25 version = "1.9.1";
26
27 src = fetchurl {
28 url = "https://www.thregr.org/~wavexx/software/fgallery/releases/fgallery-${finalAttrs.version}.zip";
29 hash = "sha256-FvF0wkRe3wTPUG9/GEBxkaxvZ1B4wEd9kI9rURHKxn0=";
30 };
31
32 nativeBuildInputs = [
33 makeWrapper
34 unzip
35 ];
36 buildInputs = (
37 with perlPackages;
38 [
39 perl
40 ImageExifTool
41 CpanelJSONXS
42 ]
43 );
44
45 postPatch = ''
46 substituteInPlace Makefile \
47 --replace "/usr" $out
48 '';
49
50 installPhase = ''
51 mkdir -p "$out/bin"
52 mkdir -p "$out/share/fgallery"
53
54 cp -r * "$out/share/fgallery"
55 ln -s -r "$out/share/fgallery/fgallery" "$out/bin/fgallery"
56
57 # Don't preserve file attributes when copying files to output directories.
58 # (fgallery copies parts of itself to each output directory, and without
59 # this change the read-only nix store causes some bumps in the workflow.)
60 sed -i -e "s|'cp'|'cp', '--no-preserve=all'|g" "$out/share/fgallery/fgallery"
61
62 wrapProgram "$out/share/fgallery/fgallery" \
63 --set PERL5LIB "$PERL5LIB" \
64 --set PATH "${
65 lib.makeBinPath [
66 coreutils
67 zip
68 imagemagick
69 pngcrush
70 lcms2
71 facedetect
72 fbida
73 ]
74 }"
75 '';
76
77 meta = {
78 description = "Static photo gallery generator";
79 homepage = "https://www.thregr.org/~wavexx/software/fgallery/";
80 license = lib.licenses.gpl2Only;
81 platforms = lib.platforms.all;
82 maintainers = [ lib.maintainers.bjornfor ];
83 mainProgram = "fgallery";
84 };
85})