summary refs log tree commit diff
path: root/pkgs/tools/graphics
diff options
context:
space:
mode:
authorFelix Buehler <account@buehler.rocks>2022-02-06 00:11:00 +0100
committerFelix Buehler <account@buehler.rocks>2022-02-06 00:11:00 +0100
commit44c6f10cc6dcef58f66f046b43fc8e8f31baa546 (patch)
tree26a9020a41a6eb6d26a82a28e8262705c6ee6983 /pkgs/tools/graphics
parenta57a774cfa50b981b16908279a0fc19589d3956b (diff)
downloadnixpkgs-44c6f10cc6dcef58f66f046b43fc8e8f31baa546.tar
nixpkgs-44c6f10cc6dcef58f66f046b43fc8e8f31baa546.tar.gz
nixpkgs-44c6f10cc6dcef58f66f046b43fc8e8f31baa546.tar.bz2
nixpkgs-44c6f10cc6dcef58f66f046b43fc8e8f31baa546.tar.lz
nixpkgs-44c6f10cc6dcef58f66f046b43fc8e8f31baa546.tar.xz
nixpkgs-44c6f10cc6dcef58f66f046b43fc8e8f31baa546.tar.zst
nixpkgs-44c6f10cc6dcef58f66f046b43fc8e8f31baa546.zip
findimagedupes: make as separate package
Diffstat (limited to 'pkgs/tools/graphics')
-rw-r--r--pkgs/tools/graphics/findimagedupes/default.nix70
1 files changed, 70 insertions, 0 deletions
diff --git a/pkgs/tools/graphics/findimagedupes/default.nix b/pkgs/tools/graphics/findimagedupes/default.nix
new file mode 100644
index 00000000000..19a80434be1
--- /dev/null
+++ b/pkgs/tools/graphics/findimagedupes/default.nix
@@ -0,0 +1,70 @@
+{ lib, stdenv, fetchurl, makeWrapper, perl, perlPackages, installShellFiles }:
+
+stdenv.mkDerivation rec {
+  pname = "findimagedupes";
+  version = "2.19.1";
+
+  # fetching this from GitHub does not contain the correct version number
+  src = fetchurl {
+    url = "http://www.jhnc.org/findimagedupes/findimagedupes-${version}.tar.gz";
+    sha256 = "sha256-5NBPoXNZays5wzpQYar4uZZb0P/zB7fdecE+SjkJjcI=";
+  };
+
+  # Work around the "unpacker appears to have produced no directories"
+  setSourceRoot = "sourceRoot=$(pwd)";
+
+  nativeBuildInputs = [ makeWrapper installShellFiles ];
+
+  buildInputs = [ perl ] ++ (with perlPackages; [
+    DBFile
+    FileMimeInfo
+    FileBaseDir
+    #GraphicsMagick
+    ImageMagick
+    Inline
+    InlineC
+    ParseRecDescent
+  ]);
+
+  # use /tmp as a storage
+  # replace GraphicsMagick with ImageMagick, because perl bindings are not yet available
+  postPatch = ''
+    substituteInPlace findimagedupes \
+      --replace "DIRECTORY => '/usr/local/lib/findimagedupes';" "DIRECTORY => '/tmp';" \
+      --replace "Graphics::Magick" "Image::Magick"
+  '';
+
+  buildPhase = "
+    runHook preBuild
+    ${perl}/bin/pod2man findimagedupes > findimagedupes.1
+    runHook postBuild
+  ";
+
+  installPhase = ''
+    runHook preInstall
+    install -D -m 755 findimagedupes $out/bin/findimagedupes
+    installManPage findimagedupes.1
+    runHook postInstall
+  '';
+
+  postFixup = ''
+    wrapProgram "$out/bin/findimagedupes" \
+      --prefix PERL5LIB : "${with perlPackages; makePerlPath [
+        DBFile
+        FileMimeInfo
+        FileBaseDir
+        #GraphicsMagick
+        ImageMagick
+        Inline
+        InlineC
+        ParseRecDescent
+      ]}"
+  '';
+
+  meta = with lib; {
+    homepage = "http://www.jhnc.org/findimagedupes/";
+    description = "Finds visually similar or duplicate images";
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ stunkymonkey ];
+  };
+}