nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 libxt,
6 libxft,
7 libxext,
8 libxaw,
9 libx11,
10 libsm,
11 libice,
12 xorgproto,
13 luit,
14 ncurses,
15 freetype,
16 fontconfig,
17 pkg-config,
18 makeWrapper,
19 nixosTests,
20 pkgsCross,
21 gitUpdater,
22 enableDecLocator ? true,
23}:
24
25stdenv.mkDerivation rec {
26 pname = "xterm";
27 version = "406";
28
29 src = fetchurl {
30 urls = [
31 "https://invisible-island.net/archives/xterm/${pname}-${version}.tgz"
32 "https://invisible-mirror.net/archives/xterm/${pname}-${version}.tgz"
33 ];
34 hash = "sha256-Bm6y1mQwiX/h2t0nFVTM2uM9d8USEmp1j8TeN7EUh5k=";
35 };
36
37 patches = [ ./sixel-256.support.patch ];
38
39 strictDeps = true;
40
41 nativeBuildInputs = [
42 makeWrapper
43 pkg-config
44 fontconfig
45 ];
46
47 buildInputs = [
48 libxaw
49 xorgproto
50 libxt
51 libxext
52 libx11
53 libsm
54 libice
55 ncurses
56 freetype
57 libxft
58 luit
59 ];
60
61 configureFlags = [
62 "--enable-wide-chars"
63 "--enable-256-color"
64 "--enable-sixel-graphics"
65 "--enable-regis-graphics"
66 "--enable-load-vt-fonts"
67 "--enable-i18n"
68 "--enable-doublechars"
69 "--enable-luit"
70 "--enable-mini-luit"
71 "--with-tty-group=tty"
72 "--with-app-defaults=$(out)/lib/X11/app-defaults"
73 ]
74 ++ lib.optional enableDecLocator "--enable-dec-locator";
75
76 env = {
77 # Work around broken "plink.sh".
78 NIX_LDFLAGS = "-lXmu -lXt -lICE -lX11 -lfontconfig";
79 }
80 // lib.optionalAttrs stdenv.hostPlatform.isMusl {
81 # Various symbols missing without this define: TAB3, NLDLY, CRDLY, BSDLY, FFDLY, CBAUD
82 NIX_CFLAGS_COMPILE = "-D_GNU_SOURCE";
83 };
84
85 # Hack to get xterm built with the feature of releasing a possible setgid of 'utmp',
86 # decided by the sysadmin to allow the xterm reporting to /var/run/utmp
87 # If we used the configure option, that would have affected the xterm installation,
88 # (setgid with the given group set), and at build time the environment even doesn't have
89 # groups, and the builder will end up removing any setgid.
90 postConfigure = ''
91 echo '#define USE_UTMP_SETGID 1'
92 '';
93
94 enableParallelBuilding = true;
95
96 postInstall = ''
97 for bin in $out/bin/*; do
98 wrapProgram $bin --set XAPPLRESDIR $out/lib/X11/app-defaults/
99 done
100
101 install -D -t $out/share/applications xterm.desktop
102 install -D -t $out/share/icons/hicolor/48x48/apps icons/xterm-color_48x48.xpm
103 '';
104
105 passthru = {
106 tests = {
107 customTest = nixosTests.xterm;
108 standardTest = nixosTests.terminal-emulators.xterm;
109 musl = pkgsCross.musl64.xterm;
110 };
111
112 updateScript = gitUpdater {
113 # No nicer place to find latest release.
114 url = "https://github.com/ThomasDickey/xterm-snapshots.git";
115 rev-prefix = "xterm-";
116 # Tags that end in letters are unstable
117 ignoredVersions = "[a-z]$";
118 };
119 };
120
121 meta = {
122 homepage = "https://invisible-island.net/xterm";
123 license = with lib.licenses; [ mit ];
124 platforms = with lib.platforms; linux ++ darwin;
125 changelog = "https://invisible-island.net/xterm/xterm.log.html";
126 mainProgram = "xterm";
127 };
128}