1 { lib, stdenv, fetchFromGitHub, fetchurl, rust, rustPlatform, cargo-c, python3 }:
3 rustPlatform.buildRustPackage rec {
4 pname = "libimagequant";
7 src = fetchFromGitHub {
11 hash = "sha256-cZgnJOmj+xJDcewsxH2Jp5AAnFZKVuYxKPtoGeN03g4=";
15 lockFile = ./Cargo.lock;
19 ln -s ${./Cargo.lock} Cargo.lock
22 nativeBuildInputs = [ cargo-c ];
26 ${rust.envVars.setEnv} cargo cbuild --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
32 ${rust.envVars.setEnv} cargo cinstall --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
37 inherit (python3.pkgs) pillow;
41 homepage = "https://pngquant.org/lib/";
42 description = "Image quantization library";
43 longDescription = "Small, portable C library for high-quality conversion of RGBA images to 8-bit indexed-color (palette) images.";
44 license = licenses.gpl3Plus;
45 platforms = platforms.unix;
46 maintainers = with maintainers; [ ma9e marsam ];