nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchurl,
5 fetchpatch,
6 desktop-file-utils,
7 gettext,
8 pkg-config,
9 meson,
10 ninja,
11 gnome,
12 glib,
13 gtk3,
14 gtk4,
15 gtkVersion ? "3",
16 gobject-introspection,
17 vala,
18 python3,
19 gi-docgen,
20 libxml2,
21 gnutls,
22 gperf,
23 pango,
24 pcre2,
25 cairo,
26 fmt_11,
27 fribidi,
28 lz4,
29 icu,
30 simdutf,
31 systemd,
32 systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd,
33 fast-float,
34 nixosTests,
35 blackbox-terminal,
36 darwinMinVersionHook,
37 withApp ? true,
38}:
39
40stdenv.mkDerivation (finalAttrs: {
41 pname = "vte";
42 version = "0.82.3";
43
44 outputs = [
45 "out"
46 "dev"
47 ]
48 ++ lib.optional (gtkVersion != null) "devdoc";
49
50 src = fetchurl {
51 url = "mirror://gnome/sources/vte/${lib.versions.majorMinor finalAttrs.version}/vte-${finalAttrs.version}.tar.xz";
52 hash = "sha256-bcYnj2/uMNB9GgPiujM1sepOjSlWzrWdhhlDEV2TCoU=";
53 };
54
55 patches = [
56 # VTE needs a small patch to work with musl:
57 # https://gitlab.gnome.org/GNOME/vte/issues/72
58 # Taken from https://git.alpinelinux.org/aports/tree/community/vte3
59 (fetchpatch {
60 name = "0001-Add-W_EXITCODE-macro-for-non-glibc-systems.patch";
61 url = "https://git.alpinelinux.org/aports/plain/community/vte3/fix-W_EXITCODE.patch?id=4d35c076ce77bfac7655f60c4c3e4c86933ab7dd";
62 hash = "sha256-FkVyhsM0mRUzZmS2Gh172oqwcfXv6PyD6IEgjBhy2uU=";
63 })
64
65 # https://gitlab.gnome.org/GNOME/vte/-/merge_requests/11
66 (fetchpatch {
67 url = "https://gitlab.gnome.org/GNOME/vte/-/commit/f672ed15a88dd3e25c33aa0a5ef6f6d291a6d5c7.patch";
68 hash = "sha256-JdLDild5j7marvR5n2heW9YD00+bwzJIoxDlzO5r/6w=";
69 })
70 ];
71
72 nativeBuildInputs = [
73 desktop-file-utils # for desktop-file-validate
74 gettext
75 gobject-introspection
76 gperf
77 libxml2
78 meson
79 ninja
80 pkg-config
81 vala
82 python3
83 gi-docgen
84 ];
85
86 buildInputs = [
87 cairo
88 fmt_11
89 fribidi
90 gnutls
91 pango # duplicated with propagatedBuildInputs to support gtkVersion == null
92 pcre2
93 lz4
94 icu
95 fast-float
96 simdutf
97 ]
98 ++ lib.optionals systemdSupport [
99 systemd
100 ]
101 ++ lib.optionals stdenv.hostPlatform.isDarwin [
102 (darwinMinVersionHook "13.3")
103 ];
104
105 # Required by vte-2.91.pc.
106 propagatedBuildInputs = lib.optionals (gtkVersion != null) [
107 (
108 assert (gtkVersion == "3" || gtkVersion == "4");
109 if gtkVersion == "3" then gtk3 else gtk4
110 )
111 glib
112 pango
113 ];
114
115 mesonFlags = [
116 "-Ddocs=true"
117 (lib.mesonBool "app" withApp)
118 (lib.mesonBool "gtk3" (gtkVersion == "3"))
119 (lib.mesonBool "gtk4" (gtkVersion == "4"))
120 (lib.mesonBool "_systemd" (!systemdSupport))
121 ]
122 ++ lib.optionals stdenv.hostPlatform.isDarwin [
123 # -Bsymbolic-functions is not supported on darwin
124 "-D_b_symbolic_functions=false"
125 ];
126
127 # error: argument unused during compilation: '-pie' [-Werror,-Wunused-command-line-argument]
128 env.NIX_CFLAGS_COMPILE = toString (
129 lib.optional stdenv.hostPlatform.isMusl "-Wno-unused-command-line-argument"
130 ++ lib.optional stdenv.cc.isClang "-Wno-cast-function-type-strict"
131 );
132
133 postPatch = ''
134 patchShebangs perf/* \
135 src/app/meson_desktopfile.py \
136 src/parser-seq.py \
137 src/minifont-coverage.py \
138 src/modes.py
139 '';
140
141 postFixup = ''
142 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
143 moveToOutput "share/doc" "$devdoc"
144 '';
145
146 passthru = {
147 updateScript = gnome.updateScript {
148 packageName = "vte";
149 versionPolicy = "odd-unstable";
150 };
151 tests = {
152 inherit (nixosTests.terminal-emulators)
153 gnome-terminal
154 lxterminal
155 mlterm
156 roxterm
157 sakura
158 stupidterm
159 terminator
160 termite
161 xfce4-terminal
162 ;
163 inherit blackbox-terminal;
164 };
165 };
166
167 meta = {
168 homepage = "https://www.gnome.org/";
169 description = "Library implementing a terminal emulator widget for GTK";
170 longDescription = ''
171 VTE is a library (libvte) implementing a terminal emulator widget for
172 GTK, and a minimal sample application (vte) using that. Vte is
173 mainly used in gnome-terminal, but can also be used to embed a
174 console/terminal in games, editors, IDEs, etc. VTE supports Unicode and
175 character set conversion, as well as emulating any terminal known to
176 the system's terminfo database.
177 '';
178 license = lib.licenses.lgpl3Plus;
179 maintainers = with lib.maintainers; [
180 antono
181 ];
182 teams = [ lib.teams.gnome ];
183 platforms = lib.platforms.unix;
184 };
185})