1{ stdenv
2, lib
3, fetchurl
4, fetchpatch
5, gettext
6, pkg-config
7, meson
8, ninja
9, gnome
10, glib
11, gtk3
12, gtk4
13, gtkVersion ? "3"
14, gobject-introspection
15, vala
16, python3
17, gi-docgen
18, libxml2
19, gnutls
20, gperf
21, pango
22, pcre2
23, fribidi
24, zlib
25, icu
26, systemd
27, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd
28, nixosTests
29}:
30
31stdenv.mkDerivation rec {
32 pname = "vte";
33 version = "0.72.1";
34
35 outputs = [ "out" "dev" "devdoc" ];
36
37 src = fetchurl {
38 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
39 sha256 = "sha256-BVT5+I1Wzi14OY/Mf2m8AOU7u8X2lOCuHcr1KG+J1+Q=";
40 };
41
42 patches = [
43 # VTE needs a small patch to work with musl:
44 # https://gitlab.gnome.org/GNOME/vte/issues/72
45 # Taken from https://git.alpinelinux.org/aports/tree/community/vte3
46 (fetchpatch {
47 name = "0001-Add-W_EXITCODE-macro-for-non-glibc-systems.patch";
48 url = "https://git.alpinelinux.org/aports/plain/community/vte3/fix-W_EXITCODE.patch?id=4d35c076ce77bfac7655f60c4c3e4c86933ab7dd";
49 sha256 = "FkVyhsM0mRUzZmS2Gh172oqwcfXv6PyD6IEgjBhy2uU=";
50 })
51 ];
52
53 nativeBuildInputs = [
54 gettext
55 gobject-introspection
56 gperf
57 libxml2
58 meson
59 ninja
60 pkg-config
61 vala
62 python3
63 gi-docgen
64 ];
65
66 buildInputs = [
67 fribidi
68 gnutls
69 pcre2
70 zlib
71 icu
72 ] ++ lib.optionals systemdSupport [
73 systemd
74 ];
75
76 propagatedBuildInputs = assert (gtkVersion == "3" || gtkVersion == "4"); [
77 # Required by vte-2.91.pc.
78 (if gtkVersion == "3" then gtk3 else gtk4)
79 glib
80 pango
81 ];
82
83 mesonFlags = [
84 "-Ddocs=true"
85 ] ++ lib.optionals (!systemdSupport) [
86 "-D_systemd=false"
87 ] ++ lib.optionals (gtkVersion == "4") [
88 "-Dgtk3=false"
89 "-Dgtk4=true"
90 ] ++ lib.optionals stdenv.isDarwin [
91 # -Bsymbolic-functions is not supported on darwin
92 "-D_b_symbolic_functions=false"
93 ];
94
95 # error: argument unused during compilation: '-pie' [-Werror,-Wunused-command-line-argument]
96 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isMusl "-Wno-unused-command-line-argument";
97
98 postPatch = ''
99 patchShebangs perf/*
100 patchShebangs src/box_drawing_generate.sh
101 patchShebangs src/parser-seq.py
102 patchShebangs src/modes.py
103 '';
104
105 postFixup = ''
106 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
107 moveToOutput "share/doc" "$devdoc"
108 '';
109
110 passthru = {
111 updateScript = gnome.updateScript {
112 packageName = pname;
113 versionPolicy = "odd-unstable";
114 };
115 tests = {
116 inherit (nixosTests.terminal-emulators) gnome-terminal lxterminal mlterm roxterm sakura stupidterm terminator termite xfce4-terminal;
117 };
118 };
119
120 meta = with lib; {
121 homepage = "https://www.gnome.org/";
122 description = "A library implementing a terminal emulator widget for GTK";
123 longDescription = ''
124 VTE is a library (libvte) implementing a terminal emulator widget for
125 GTK, and a minimal sample application (vte) using that. Vte is
126 mainly used in gnome-terminal, but can also be used to embed a
127 console/terminal in games, editors, IDEs, etc. VTE supports Unicode and
128 character set conversion, as well as emulating any terminal known to
129 the system's terminfo database.
130 '';
131 license = licenses.lgpl3Plus;
132 maintainers = with maintainers; [ astsmtl antono ] ++ teams.gnome.members;
133 platforms = platforms.unix;
134 };
135}