image_optim: remove 'with lib;'

This commit is contained in:
Felix Buehler 2024-08-13 22:02:52 +02:00 committed by Valentin Gagarin
parent ec71a11431
commit 78e434a4ac

View File

@ -13,34 +13,32 @@
withSvgo ? true, svgo withSvgo ? true, svgo
}: }:
with lib;
let let
optionalDepsPath = optional withPngcrush pngcrush optionalDepsPath = lib.optional withPngcrush pngcrush
++ optional withPngout pngout ++ lib.optional withPngout pngout
++ optional withAdvpng advancecomp ++ lib.optional withAdvpng advancecomp
++ optional withOptipng optipng ++ lib.optional withOptipng optipng
++ optional withPngquant pngquant ++ lib.optional withPngquant pngquant
++ optional withOxipng oxipng ++ lib.optional withOxipng oxipng
++ optional withJhead jhead ++ lib.optional withJhead jhead
++ optional withJpegoptim jpegoptim ++ lib.optional withJpegoptim jpegoptim
++ optional withJpegrecompress jpeg-archive ++ lib.optional withJpegrecompress jpeg-archive
++ optional withJpegtran libjpeg ++ lib.optional withJpegtran libjpeg
++ optional withGifsicle gifsicle ++ lib.optional withGifsicle gifsicle
++ optional withSvgo svgo; ++ lib.optional withSvgo svgo;
disabledWorkersFlags = optional (!withPngcrush) "--no-pngcrush" disabledWorkersFlags = lib.optional (!withPngcrush) "--no-pngcrush"
++ optional (!withPngout) "--no-pngout" ++ lib.optional (!withPngout) "--no-pngout"
++ optional (!withAdvpng) "--no-advpng" ++ lib.optional (!withAdvpng) "--no-advpng"
++ optional (!withOptipng) "--no-optipng" ++ lib.optional (!withOptipng) "--no-optipng"
++ optional (!withPngquant) "--no-pngquant" ++ lib.optional (!withPngquant) "--no-pngquant"
++ optional (!withOxipng) "--no-oxipng" ++ lib.optional (!withOxipng) "--no-oxipng"
++ optional (!withJhead) "--no-jhead" ++ lib.optional (!withJhead) "--no-jhead"
++ optional (!withJpegoptim) "--no-jpegoptim" ++ lib.optional (!withJpegoptim) "--no-jpegoptim"
++ optional (!withJpegrecompress) "--no-jpegrecompress" ++ lib.optional (!withJpegrecompress) "--no-jpegrecompress"
++ optional (!withJpegtran) "--no-jpegtran" ++ lib.optional (!withJpegtran) "--no-jpegtran"
++ optional (!withGifsicle) "--no-gifsicle" ++ lib.optional (!withGifsicle) "--no-gifsicle"
++ optional (!withSvgo) "--no-svgo"; ++ lib.optional (!withSvgo) "--no-svgo";
in in
bundlerApp { bundlerApp {
@ -53,7 +51,7 @@ bundlerApp {
postBuild = '' postBuild = ''
wrapProgram $out/bin/image_optim \ wrapProgram $out/bin/image_optim \
--prefix PATH : ${lib.escapeShellArg (makeBinPath optionalDepsPath)} \ --prefix PATH : ${lib.escapeShellArg (lib.makeBinPath optionalDepsPath)} \
--add-flags "${lib.concatStringsSep " " disabledWorkersFlags}" --add-flags "${lib.concatStringsSep " " disabledWorkersFlags}"
''; '';