1{ lib
2, stdenv
3, fetchFromGitHub
4, cmake
5, libdeflate
6, libunistring
7, ncurses
8, pandoc
9, pkg-config
10, zlib
11, multimediaSupport ? true, ffmpeg
12, qrcodegenSupport ? true, qrcodegen
13}:
14
15stdenv.mkDerivation rec {
16 pname = "notcurses";
17 version = "3.0.9";
18
19 src = fetchFromGitHub {
20 owner = "dankamongmen";
21 repo = "notcurses";
22 rev = "v${version}";
23 sha256 = "sha256-8SJeqLcV4xp968YgGsJccsgpB5wwaJDaoWsaYxf8upM=";
24 };
25
26 outputs = [ "out" "dev" ];
27
28 nativeBuildInputs = [
29 cmake
30 pandoc
31 pkg-config
32 ];
33
34 buildInputs = [
35 libdeflate
36 libunistring
37 ncurses
38 zlib
39 ]
40 ++ lib.optional qrcodegenSupport qrcodegen
41 ++ lib.optional multimediaSupport ffmpeg;
42
43 cmakeFlags =
44 lib.optional (qrcodegenSupport) "-DUSE_QRCODEGEN=ON"
45 ++ lib.optional (!multimediaSupport) "-DUSE_MULTIMEDIA=none";
46
47 # https://github.com/dankamongmen/notcurses/issues/2661
48 postPatch = ''
49 substituteInPlace tools/notcurses-core.pc.in \
50 --replace '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
51 --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
52 substituteInPlace tools/notcurses-ffi.pc.in \
53 --replace '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
54 --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
55 substituteInPlace tools/notcurses++.pc.in \
56 --replace '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
57 --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
58 substituteInPlace tools/notcurses.pc.in \
59 --replace '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
60 --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
61 '';
62
63 meta = with lib; {
64 homepage = "https://github.com/dankamongmen/notcurses";
65 description = "Blingful TUIs and character graphics";
66 longDescription = ''
67 Notcurses is a library facilitating complex TUIs on modern terminal
68 emulators, supporting vivid colors, multimedia, and Unicode to the maximum
69 degree possible. Things can be done with Notcurses that simply can't be
70 done with NCURSES.
71
72 It is not a source-compatible X/Open Curses implementation, nor a
73 replacement for NCURSES on existing systems.
74 '';
75 license = licenses.asl20;
76 maintainers = with maintainers; [ AndersonTorres ];
77 inherit (ncurses.meta) platforms;
78 };
79}