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