about summary refs log tree commit diff
path: root/pkgs/by-name/gr/graphicsmagick/imagemagick-compat.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/gr/graphicsmagick/imagemagick-compat.nix')
-rw-r--r--pkgs/by-name/gr/graphicsmagick/imagemagick-compat.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/pkgs/by-name/gr/graphicsmagick/imagemagick-compat.nix b/pkgs/by-name/gr/graphicsmagick/imagemagick-compat.nix
new file mode 100644
index 0000000000000..9e278da037bc8
--- /dev/null
+++ b/pkgs/by-name/gr/graphicsmagick/imagemagick-compat.nix
@@ -0,0 +1,48 @@
+{ lib
+, graphicsmagick
+, stdenvNoCC
+}:
+
+stdenvNoCC.mkDerivation {
+  pname = "graphicsmagick-imagemagick-compat";
+  inherit (graphicsmagick) version;
+
+  outputs = [ "out" "man" ];
+
+  dontUnpack = true;
+  dontBuild = true;
+
+  # TODO: symlink libraries?
+  installPhase = let
+    utilities = [
+      "animate"
+      "composite"
+      "conjure"
+      "convert"
+      "display"
+      "identify"
+      "import"
+      "mogrify"
+      "montage"
+    ];
+    linkUtilityBin = utility: ''
+      ln -s ${lib.getExe graphicsmagick} "$out/bin/${utility}"
+    '';
+    linkUtilityMan = utility: ''
+      ln -s ${lib.getMan graphicsmagick}/share/man/man1/gm.1.gz "$man/share/man/man1/${utility}.1.gz"
+    '';
+  in ''
+    runHook preInstall
+
+    mkdir -p "$out"/bin
+    ${lib.concatStringsSep "\n" (map linkUtilityBin utilities)}
+    mkdir -p "$man"/share/man/man1
+    ${lib.concatStringsSep "\n" (map linkUtilityMan utilities)}
+
+    runHook postInstall
+  '';
+
+  meta = graphicsmagick.meta // {
+    description = "A repack of GraphicsMagick that provides compatibility with ImageMagick interfaces";
+  };
+}