diff options
author | Anderson Torres <torres.anderson.85@protonmail.com> | 2024-03-24 19:12:06 -0300 |
---|---|---|
committer | Anderson Torres <torres.anderson.85@protonmail.com> | 2024-03-27 12:13:09 -0300 |
commit | 817f57da1368e2966d982f44b143d180fffd6d18 (patch) | |
tree | 925ee290cedefaffebf561601df96c84c4e7c865 /pkgs/applications/graphics | |
parent | 6503efacb40598161f0db021fdf63c332d1c8a76 (diff) |
graphicsmagick-imagemagick-compat: refactor
- use stdenvNoCC (since no compiler is called) - split man output - do not expose attributes - set `dontBuild = true` instead of using a fake `buildPhase` - install the artifacts via an elegant but questionable, Lispy dark magic (cherry picked from commit 7bfecb71e37a0ca6a722ed9117ca0b09517c0cdd)
Diffstat (limited to 'pkgs/applications/graphics')
-rw-r--r-- | pkgs/applications/graphics/graphicsmagick/imagemagick-compat.nix | 61 |
1 files changed, 36 insertions, 25 deletions
diff --git a/pkgs/applications/graphics/graphicsmagick/imagemagick-compat.nix b/pkgs/applications/graphics/graphicsmagick/imagemagick-compat.nix index b715093308fab..9e278da037bc8 100644 --- a/pkgs/applications/graphics/graphicsmagick/imagemagick-compat.nix +++ b/pkgs/applications/graphics/graphicsmagick/imagemagick-compat.nix @@ -1,37 +1,48 @@ -{ lib, stdenv, graphicsmagick }: +{ lib +, graphicsmagick +, stdenvNoCC +}: -stdenv.mkDerivation { +stdenvNoCC.mkDerivation { pname = "graphicsmagick-imagemagick-compat"; inherit (graphicsmagick) version; - dontUnpack = true; - buildPhase = "true"; + outputs = [ "out" "man" ]; - utils = [ - "composite" - "conjure" - "convert" - "identify" - "mogrify" - "montage" - "animate" - "display" - "import" - ]; + dontUnpack = true; + dontBuild = true; # TODO: symlink libraries? - installPhase = '' + 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 - mkdir -p "$out"/share/man/man1 - for util in ''${utils[@]}; do - ln -s ${graphicsmagick}/bin/gm "$out/bin/$util" - ln -s ${graphicsmagick}/share/man/man1/gm.1.gz "$out/share/man/man1/$util.1.gz" - done + ${lib.concatStringsSep "\n" (map linkUtilityBin utilities)} + mkdir -p "$man"/share/man/man1 + ${lib.concatStringsSep "\n" (map linkUtilityMan utilities)} + + runHook postInstall ''; - meta = { - description = "ImageMagick interface for GraphicsMagick"; - license = lib.licenses.free; - platforms = lib.platforms.all; + meta = graphicsmagick.meta // { + description = "A repack of GraphicsMagick that provides compatibility with ImageMagick interfaces"; }; } |