Compiling perl package with graphicsmagick

Hey everyone,
I am trying to compile findimagedupes.

It is available on the command-line, but it throws errors:
Can't locate Graphics/Magick.pm in @INC (you may need to install the Graphics::Magick module) (@INC contains: ...
This is due to this line

It needs GraphicsMagick as a dependency, but i only find PerlMagick compiled with ImageMagick.

My current code

any ideas on how to fix this? Any other suggestions?
Thanks in advance

Looking at it, there isn’t a PerlMagick compiled from GraphicsMagick in Nixpkgs. It looks like it might require customizing the PerlMagick/Makefile.PL after downloading the latest tarball, but I’m not sure.

I haven’t written Perl Packages for Nix, but I can definitely say that there isn’t an already-written package of GraphicsMagick or PerlMagick in Nixpkgs that will easily solve your problem.

thanks for your info. i am not super advanced in writing packages, but i will have a look at it.

I am having the same problem! I try to package findimagedupes, and it requires the same library. I tried adding graphicsmagick but it does not seem to include the perl library. My current derivation is:

{ lib
, fetchFromGitHub
, git
, graphicsmagick
, makeWrapper
, perlPackages
, stdenv
}:

stdenv.mkDerivation rec {
  pname = "findimagedupes";
  version = "2.19.1";

  src = fetchFromGitHub {
    owner = "jhnc";
    repo = "${pname}";
    rev = "${version}";
    sha256 = "19hchaxzzq7kwrcnm3m2zyigq38kdc9l0jp6pz6cm9hfxna58518";
  };

  meta = with lib; {
    description = "Find visually similar or duplicate images";
    homepage = "https://github.com/jhnc/findimagedupes";
    license = licenses.asl20;
    maintainers = with maintainers; [ dschrempf ];
  };

  nativeBuildInputs = with perlPackages; [ makeWrapper PodMarkdown ];

  propagatedBuildInputs = with perlPackages; [ perl graphicsmagick ];

  preBuild = ''
    sed -i -e "s:DIRECTORY => '/usr/local/lib/findimagedupes':DIRECTORY => '/tmp':" findimagedupes
  '';

  buildPhase = "
    pod2man findimagedupes > findimagedupes.1
  ";

  installPhase = ''
    install -D -m 755 findimagedupes $out/bin/findimagedupes
    wrapProgram $out/bin/findimagedupes --set PERL5LIB ${with perlPackages; makeFullPerlPath [ DBFile FileBaseDir FileMimeInfo InlineC ]}
    install -D -m 644 findimagedupes.1 $out/share/man/man1/findimagedupes.1
  '';
}

we basically have the same goal, but i am still struggling to provide PerlGraphicsMagic-bindings. maybe you want to have a look at: findimagedupes: init at 2.19.1 · Stunkymonkey/nixpkgs@c78fd8d · GitHub
the work at pkgs/applications/graphics/graphicsmagick/default.nix is not finished at all.

my current progress can be seen here: findimagedupes: init at 2.19.1 · Stunkymonkey/nixpkgs@4dec0e1 · GitHub
the current error is

/nix/store/fvrj6qiyrf3vg7dhh2lgk9pf2ks7b7yn-graphicsmagick-1.3.36-dev/include/GraphicsMagick/magick/log.h:122:12: fatal error: magick/log-private.h: No such file or directory
  122 | #  include "magick/log-private.h"
      |            ^~~~~~~~~~~~~~~~~~~~~~

maybe @dschrempf you want to have a good look at it. It is not pretty, but first i want to get it to work.

Hi, thanks!

I had a look at it and there are still some problems. However, I don’t know how to proceed. See my PR Findimagedupes master by dschrempf · Pull Request #1 · Stunkymonkey/nixpkgs · GitHub