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