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