hoarder: 0.21.0 -> 0.22.0
[NixPkgs.git] / pkgs / by-name / fg / fgallery / package.nix
blob3d60062a4c2136b764335524c4a2bac6b27ab04a
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,
17 # TODO: add optional dependencies (snippet from fgallery source):
19 # if(system("jpegoptim -V >/dev/null 2>&1")) {
20 #   $jpegoptim = 0;
21 # }
23 stdenv.mkDerivation rec {
24   pname = "fgallery";
25   version = "1.9.1";
27   src = fetchurl {
28     url = "https://www.thregr.org/~wavexx/software/fgallery/releases/fgallery-${version}.zip";
29     hash = "sha256-FvF0wkRe3wTPUG9/GEBxkaxvZ1B4wEd9kI9rURHKxn0=";
30   };
32   nativeBuildInputs = [
33     makeWrapper
34     unzip
35   ];
36   buildInputs = (
37     with perlPackages;
38     [
39       perl
40       ImageExifTool
41       CpanelJSONXS
42     ]
43   );
45   postPatch = ''
46     substituteInPlace Makefile \
47       --replace "/usr" $out
48   '';
50   installPhase = ''
51     mkdir -p "$out/bin"
52     mkdir -p "$out/share/fgallery"
54     cp -r * "$out/share/fgallery"
55     ln -s -r "$out/share/fgallery/fgallery" "$out/bin/fgallery"
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"
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   '';
77   meta = with lib; {
78     description = "Static photo gallery generator";
79     homepage = "https://www.thregr.org/~wavexx/software/fgallery/";
80     license = licenses.gpl2Only;
81     platforms = platforms.all;
82     maintainers = [ maintainers.bjornfor ];
83     mainProgram = "fgallery";
84   };