Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, bundlerApp, bundlerUpdateScript, makeWrapper, 2 withPngcrush ? true, pngcrush, 3 withPngout ? false, pngout, # disabled by default because it's unfree 4 withAdvpng ? true, advancecomp, 5 withOptipng ? true, optipng, 6 withPngquant ? true, pngquant, 7 withOxipng ? true, oxipng, 8 withJhead ? true, jhead, 9 withJpegoptim ? true, jpegoptim, 10 withJpegrecompress ? true, jpeg-archive, 11 withJpegtran ? true, libjpeg, 12 withGifsicle ? true, gifsicle, 13 withSvgo ? true, svgo 14}: 15 16with lib; 17 18let 19 optionalDepsPath = optional withPngcrush pngcrush 20 ++ optional withPngout pngout 21 ++ optional withAdvpng advancecomp 22 ++ optional withOptipng optipng 23 ++ optional withPngquant pngquant 24 ++ optional withOxipng oxipng 25 ++ optional withJhead jhead 26 ++ optional withJpegoptim jpegoptim 27 ++ optional withJpegrecompress jpeg-archive 28 ++ optional withJpegtran libjpeg 29 ++ optional withGifsicle gifsicle 30 ++ optional withSvgo svgo; 31 32 disabledWorkersFlags = optional (!withPngcrush) "--no-pngcrush" 33 ++ optional (!withPngout) "--no-pngout" 34 ++ optional (!withAdvpng) "--no-advpng" 35 ++ optional (!withOptipng) "--no-optipng" 36 ++ optional (!withPngquant) "--no-pngquant" 37 ++ optional (!withOxipng) "--no-oxipng" 38 ++ optional (!withJhead) "--no-jhead" 39 ++ optional (!withJpegoptim) "--no-jpegoptim" 40 ++ optional (!withJpegrecompress) "--no-jpegrecompress" 41 ++ optional (!withJpegtran) "--no-jpegtran" 42 ++ optional (!withGifsicle) "--no-gifsicle" 43 ++ optional (!withSvgo) "--no-svgo"; 44in 45 46bundlerApp { 47 pname = "image_optim"; 48 gemdir = ./.; 49 50 exes = [ "image_optim" ]; 51 52 nativeBuildInputs = [ makeWrapper ]; 53 54 postBuild = '' 55 wrapProgram $out/bin/image_optim \ 56 --prefix PATH : ${lib.escapeShellArg (makeBinPath optionalDepsPath)} \ 57 --add-flags "${lib.concatStringsSep " " disabledWorkersFlags}" 58 ''; 59 60 passthru.updateScript = bundlerUpdateScript "image_optim"; 61 62 meta = with lib; { 63 description = "Optimize images using multiple utilities"; 64 longDescription = '' 65 Command line tool and ruby interface to optimize (lossless compress, 66 optionally lossy) jpeg, png, gif and svg images using external utilities 67 (advpng, gifsicle, jhead, jpeg-recompress, jpegoptim, jpegrescan, 68 jpegtran, optipng, oxipng, pngcrush, pngout, pngquant, svgo) 69 ''; 70 homepage = "https://github.com/toy/image_optim"; 71 license = licenses.mit; 72 maintainers = with maintainers; [ srghma nicknovitski ]; 73 platforms = platforms.all; 74 }; 75}