Files
nixpkgs/pkgs/by-name/op/optipng/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

57 lines
1.2 KiB
Nix

{
lib,
stdenv,
fetchurl,
libpng,
static ? stdenv.hostPlatform.isStatic,
}:
# This package comes with its own copy of zlib, libpng and pngxtern
stdenv.mkDerivation rec {
pname = "optipng";
version = "7.9.1";
src = fetchurl {
url = "mirror://sourceforge/optipng/optipng-${version}.tar.gz";
hash = "sha256-wleb5YwsZtrp1jFU7cs9Qn/vZMsA7Ar/B5ydFW7Ebyk=";
};
buildInputs = [ libpng ];
# Workaround for crash in cexcept.h. See
# https://github.com/NixOS/nixpkgs/issues/28106
preConfigure = ''
export LD=$CC
'';
# OptiPNG does not like --static, --build or --host
dontDisableStatic = true;
dontAddStaticConfigureFlags = true;
configurePlatforms = [ ];
configureFlags = [
"--with-system-zlib"
"--with-system-libpng"
]
++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
#"-prefix=$out"
];
postInstall =
if stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.isWindows then
''
mv "$out"/bin/optipng{,.exe}
''
else
null;
meta = with lib; {
homepage = "https://optipng.sourceforge.net/";
description = "PNG optimizer";
license = licenses.zlib;
platforms = platforms.unix;
mainProgram = "optipng";
};
}