depot/third_party/nixpkgs/pkgs/by-name/gr/graphicsmagick/imagemagick-compat.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

48 lines
1.1 KiB
Nix

{ 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 = "Repack of GraphicsMagick that provides compatibility with ImageMagick interfaces";
};
}