1{ lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, pkg-config, which
2, libxslt, libxml2, docbook_xml_dtd_412, docbook_xsl, glib, imagemagick
3, Foundation
4}:
5
6stdenv.mkDerivation rec {
7 version = "1.14.0";
8 pname = "chafa";
9
10 src = fetchFromGitHub {
11 owner = "hpjansson";
12 repo = "chafa";
13 rev = version;
14 sha256 = "sha256-7l8+WD5/5uBXVnhwqiEScIEQ1dg0W2zqqZJ2AeKCZRU=";
15 };
16
17 nativeBuildInputs = [ autoconf
18 automake
19 libtool
20 pkg-config
21 which
22 libxslt
23 libxml2
24 docbook_xml_dtd_412
25 docbook_xsl
26 ];
27
28 buildInputs = [ glib imagemagick ]
29 ++ lib.optional stdenv.isDarwin Foundation;
30
31 patches = [ ./xmlcatalog_patch.patch ];
32
33 preConfigure = ''
34 substituteInPlace ./autogen.sh --replace pkg-config '$PKG_CONFIG'
35 NOCONFIGURE=1 ./autogen.sh
36 '';
37
38 configureFlags = [ "--enable-man"
39 "--with-xml-catalog=${docbook_xml_dtd_412}/xml/dtd/docbook/catalog.xml"
40 ];
41
42 # https://github.com/NixOS/nixpkgs/pull/240893#issuecomment-1635347507
43 NIX_LDFLAGS = [ "-lwebp" ];
44
45 meta = with lib; {
46 description = "Terminal graphics for the 21st century";
47 homepage = "https://hpjansson.org/chafa/";
48 license = licenses.lgpl3Plus;
49 platforms = platforms.all;
50 maintainers = [ maintainers.mog ];
51 mainProgram = "chafa";
52 };
53}