image_optim: add oxipng, fix optional workers

Support for [oxipng](https://github.com/shssoichiro/oxipng) was added with [version 0.31.0](https://github.com/toy/image_optim/blob/master/CHANGELOG.markdown#v0310-2021-10-03). So we add `oxipng` as an optional dependency.

If some optional workers are disabled `image_optim` fails with an error message like:
```
Bin resolving errors:
pngout worker: `pngout` not found; please provide proper binary or disable this worker (--no-pngout argument or `:pngout => false` through options)
```
To fix the problem the flag `--no-program` is added while wrapping if the worker `program` is disabled.

kilianar 96c41775 5d1eee6c

+29 -8
+29 -8
pkgs/applications/graphics/image_optim/default.nix
··· 1 1 { lib, bundlerApp, bundlerUpdateScript, makeWrapper, 2 2 withPngcrush ? true, pngcrush, 3 - withPngout ? true, pngout, 3 + withPngout ? false, pngout, # disabled by default because it's unfree 4 4 withAdvpng ? true, advancecomp, 5 5 withOptipng ? true, optipng, 6 6 withPngquant ? true, pngquant, 7 + withOxipng ? true, oxipng, 7 8 withJhead ? true, jhead, 8 9 withJpegoptim ? true, jpegoptim, 9 10 withJpegrecompress ? true, jpeg-archive, ··· 15 16 with lib; 16 17 17 18 let 18 - optionalDepsPath = [] 19 - ++ optional withPngcrush pngcrush 19 + optionalDepsPath = optional withPngcrush pngcrush 20 20 ++ optional withPngout pngout 21 21 ++ optional withAdvpng advancecomp 22 22 ++ optional withOptipng optipng 23 23 ++ optional withPngquant pngquant 24 + ++ optional withOxipng oxipng 24 25 ++ optional withJhead jhead 25 26 ++ optional withJpegoptim jpegoptim 26 27 ++ optional withJpegrecompress jpeg-archive 27 28 ++ optional withJpegtran libjpeg 28 29 ++ optional withGifsicle gifsicle 29 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"; 30 44 in 31 45 32 46 bundlerApp { ··· 39 53 40 54 postBuild = '' 41 55 wrapProgram $out/bin/image_optim \ 42 - --prefix PATH : ${lib.escapeShellArg (makeBinPath optionalDepsPath)} 56 + --prefix PATH : ${lib.escapeShellArg (makeBinPath optionalDepsPath)} \ 57 + --add-flags "${lib.concatStringsSep " " disabledWorkersFlags}" 43 58 ''; 44 59 45 60 passthru.updateScript = bundlerUpdateScript "image_optim"; 46 61 47 62 meta = with lib; { 48 - 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)"; 49 - homepage = "https://github.com/toy/image_optim"; 50 - license = licenses.mit; 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; 51 72 maintainers = with maintainers; [ srghma nicknovitski ]; 52 - platforms = platforms.all; 73 + platforms = platforms.all; 53 74 }; 54 75 }