acr-cli: init at 0.14 (#359508)
[NixPkgs.git] / pkgs / by-name / fg / fgallery / package.nix
blob8e2e636d90f7ef8e151e27b8aca942e5ca21f595
1 { lib, stdenv, fetchurl, unzip, makeWrapper, perlPackages
2 , coreutils, zip, imagemagick, pngcrush, lcms2
3 , facedetect, fbida }:
5 # TODO: add optional dependencies (snippet from fgallery source):
7 # if(system("jpegoptim -V >/dev/null 2>&1")) {
8 #   $jpegoptim = 0;
9 # }
11 stdenv.mkDerivation rec {
12   pname = "fgallery";
13   version = "1.9.1";
15   src = fetchurl {
16     url = "https://www.thregr.org/~wavexx/software/fgallery/releases/fgallery-${version}.zip";
17     hash = "sha256-FvF0wkRe3wTPUG9/GEBxkaxvZ1B4wEd9kI9rURHKxn0=";
18   };
20   nativeBuildInputs = [ makeWrapper unzip ];
21   buildInputs = (with perlPackages; [ perl ImageExifTool CpanelJSONXS ]);
23   postPatch = ''
24     substituteInPlace Makefile \
25       --replace "/usr" $out
26   '';
28   installPhase = ''
29     mkdir -p "$out/bin"
30     mkdir -p "$out/share/fgallery"
32     cp -r * "$out/share/fgallery"
33     ln -s -r "$out/share/fgallery/fgallery" "$out/bin/fgallery"
35     # Don't preserve file attributes when copying files to output directories.
36     # (fgallery copies parts of itself to each output directory, and without
37     # this change the read-only nix store causes some bumps in the workflow.)
38     sed -i -e "s|'cp'|'cp', '--no-preserve=all'|g" "$out/share/fgallery/fgallery"
40     wrapProgram "$out/share/fgallery/fgallery" \
41         --set PERL5LIB "$PERL5LIB" \
42         --set PATH "${lib.makeBinPath
43                      [ coreutils zip imagemagick pngcrush lcms2 facedetect fbida ]}"
44   '';
46   meta = with lib; {
47     description = "Static photo gallery generator";
48     homepage = "https://www.thregr.org/~wavexx/software/fgallery/";
49     license = licenses.gpl2Only;
50     platforms = platforms.all;
51     maintainers = [ maintainers.bjornfor ];
52     mainProgram = "fgallery";
53   };