1{ lib
2, stdenv
3, fetchFromGitHub
4, libiconv
5}:
6
7stdenv.mkDerivation rec {
8 pname = "leanify";
9 version = "unstable-2022-12-04";
10
11 src = fetchFromGitHub {
12 owner = "JayXon";
13 repo = "Leanify";
14 rev = "7847668ac5bf0df1d940b674bc8b907bd1b37044";
15 hash = "sha256-KxVV7AW9sEfH4YTPDfeJk7fMMGh0eSkECXM/Mv9XqBA=";
16 };
17
18 postPatch = lib.optionalString stdenv.isDarwin ''
19 substituteInPlace Makefile \
20 --replace "-flto" "" \
21 --replace "lib/LZMA/Alloc.o" "lib/LZMA/CpuArch.o lib/LZMA/Alloc.o"
22 '';
23
24 buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
25
26 installPhase = ''
27 runHook preInstall
28
29 mkdir -p $out/bin
30 cp leanify $out/bin/
31
32 runHook postInstall
33 '';
34
35 meta = with lib; {
36 description = "Lightweight lossless file minifier/optimizer";
37 longDescription = ''
38 Leanify is a lightweight lossless file minifier/optimizer.
39 It removes unnecessary data (debug information, comments, metadata, etc.) and recompress the file to reduce file size.
40 It will not reduce image quality at all.
41 '';
42 homepage = "https://github.com/JayXon/Leanify";
43 changelog = "https://github.com/JayXon/Leanify/blob/master/CHANGELOG.md";
44 license = licenses.mit;
45 maintainers = [ maintainers.mynacol ];
46 platforms = platforms.all;
47 };
48}