2019-07-22 13:02:47 +01:00
|
|
|
{ lib, bundlerApp, bundlerUpdateScript, makeWrapper,
|
2019-03-17 20:19:24 +00:00
|
|
|
withPngcrush ? true, pngcrush ? null,
|
|
|
|
withPngout ? true, pngout ? null,
|
|
|
|
withAdvpng ? true, advancecomp ? null,
|
|
|
|
withOptipng ? true, optipng ? null,
|
|
|
|
withPngquant ? true, pngquant ? null,
|
|
|
|
withJhead ? true, jhead ? null,
|
|
|
|
withJpegoptim ? true, jpegoptim ? null,
|
|
|
|
withJpegrecompress ? true, jpeg-archive ? null,
|
|
|
|
withJpegtran ? true, libjpeg ? null,
|
|
|
|
withGifsicle ? true, gifsicle ? null,
|
|
|
|
withSvgo ? true, svgo ? null
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert withPngcrush -> pngcrush != null;
|
|
|
|
assert withPngout -> pngout != null;
|
|
|
|
assert withAdvpng -> advancecomp != null;
|
|
|
|
assert withOptipng -> optipng != null;
|
|
|
|
assert withPngquant -> pngquant != null;
|
|
|
|
assert withJhead -> jhead != null;
|
|
|
|
assert withJpegoptim -> jpegoptim != null;
|
|
|
|
assert withJpegrecompress -> jpeg-archive != null;
|
|
|
|
assert withJpegtran -> libjpeg != null;
|
|
|
|
assert withGifsicle -> gifsicle != null;
|
|
|
|
assert withSvgo -> svgo != null;
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
2019-03-17 20:26:08 +00:00
|
|
|
optionalDepsPath = []
|
2019-03-17 20:19:24 +00:00
|
|
|
++ optional withPngcrush pngcrush
|
|
|
|
++ optional withPngout pngout
|
|
|
|
++ optional withAdvpng advancecomp
|
|
|
|
++ optional withOptipng optipng
|
|
|
|
++ optional withPngquant pngquant
|
|
|
|
++ optional withJhead jhead
|
|
|
|
++ optional withJpegoptim jpegoptim
|
|
|
|
++ optional withJpegrecompress jpeg-archive
|
|
|
|
++ optional withJpegtran libjpeg
|
|
|
|
++ optional withGifsicle gifsicle
|
2019-03-17 20:26:08 +00:00
|
|
|
++ optional withSvgo svgo;
|
2019-03-17 20:19:24 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
bundlerApp {
|
|
|
|
pname = "image_optim";
|
|
|
|
gemdir = ./.;
|
|
|
|
|
|
|
|
exes = [ "image_optim" ];
|
|
|
|
|
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
postBuild = ''
|
|
|
|
wrapProgram $out/bin/image_optim \
|
2019-03-17 20:26:08 +00:00
|
|
|
--prefix PATH : ${makeBinPath optionalDepsPath}
|
2019-03-17 20:19:24 +00:00
|
|
|
'';
|
|
|
|
|
2019-07-22 13:02:47 +01:00
|
|
|
passthru.updateScript = bundlerUpdateScript "image_optim";
|
|
|
|
|
2019-03-17 20:19:24 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Command line tool and ruby interface to optimize (lossless compress, optionally lossy) jpeg, png, gif and svg images using external utilities (advpng, gifsicle, jhead, jpeg-recompress, jpegoptim, jpegrescan, jpegtran, optipng, pngcrush, pngout, pngquant, svgo)";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/toy/image_optim";
|
2019-03-17 20:19:24 +00:00
|
|
|
license = licenses.mit;
|
2019-07-22 13:02:47 +01:00
|
|
|
maintainers = with maintainers; [ srghma nicknovitski ];
|
2019-03-17 20:19:24 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|