1 { lib, stdenv, fetchurl, fetchpatch, xorg, ncurses, freetype, fontconfig
2 , pkg-config, makeWrapper, nixosTests, writeScript, common-updater-scripts, git
3 , nixfmt, nix, gnused, coreutils, enableDecLocator ? true }:
5 stdenv.mkDerivation rec {
11 "ftp://ftp.invisible-island.net/xterm/${pname}-${version}.tgz"
12 "https://invisible-mirror.net/archives/xterm/${pname}-${version}.tgz"
14 sha256 = "sha256-EdTWJmcNTW17aft0Z+nsIxgX5a0iUC+RZ3aP2IrBvfU=";
19 nativeBuildInputs = [ makeWrapper pkg-config fontconfig ];
35 patches = [ ./sixel-256.support.patch ]
36 ++ lib.optional stdenv.hostPlatform.isMusl (fetchpatch {
37 name = "posix-ptys.patch";
39 "https://git.alpinelinux.org/aports/plain/community/xterm/posix-ptys.patch?id=3aa532e77875fa1db18c7fcb938b16647031bcc1";
40 sha256 = "0czgnsxkkmkrk1idw69qxbprh0jb4sw3c24zpnqq2v76jkl7zvlr";
46 "--enable-sixel-graphics"
47 "--enable-regis-graphics"
48 "--enable-load-vt-fonts"
50 "--enable-doublechars"
53 "--with-tty-group=tty"
54 "--with-app-defaults=$(out)/lib/X11/app-defaults"
55 ] ++ lib.optional enableDecLocator "--enable-dec-locator";
57 # Work around broken "plink.sh".
58 NIX_LDFLAGS = "-lXmu -lXt -lICE -lX11 -lfontconfig";
60 # Hack to get xterm built with the feature of releasing a possible setgid of 'utmp',
61 # decided by the sysadmin to allow the xterm reporting to /var/run/utmp
62 # If we used the configure option, that would have affected the xterm installation,
63 # (setgid with the given group set), and at build time the environment even doesn't have
64 # groups, and the builder will end up removing any setgid.
66 echo '#define USE_UTMP_SETGID 1'
70 for bin in $out/bin/*; do
71 wrapProgram $bin --set XAPPLRESDIR $out/lib/X11/app-defaults/
74 install -D -t $out/share/applications xterm.desktop
75 install -D -t $out/share/icons/hicolor/48x48/apps icons/xterm-color_48x48.xpm
80 customTest = nixosTests.xterm;
81 standardTest = nixosTests.terminal-emulators.xterm;
85 # Tags that end in letters are unstable
86 suffixes = lib.concatStringsSep " "
87 (map (c: "-c versionsort.suffix='${c}'")
88 (lib.stringToCharacters "abcdefghijklmnopqrstuvwxyz"));
89 in writeScript "update.sh" ''
94 common-updater-scripts
103 oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion ${pname}" | tr -d '"')"
104 latestTag="$(git ${suffixes} ls-remote --exit-code --refs --sort='version:refname' --tags git@github.com:ThomasDickey/xterm-snapshots.git 'xterm-*' | tail --lines=1 | cut --delimiter='/' --fields=3 | sed 's|^xterm-||g')"
106 if [ ! "$oldVersion" = "$latestTag" ]; then
107 update-source-version ${pname} "$latestTag" --version-key=version --print-changes
108 nixpkgs="$(git rev-parse --show-toplevel)"
109 default_nix="$nixpkgs/pkgs/applications/terminal-emulators/xterm/default.nix"
110 nixfmt "$default_nix"
112 echo "${pname} is already up-to-date"
118 homepage = "https://invisible-island.net/xterm";
119 license = with lib.licenses; [ mit ];
120 maintainers = with lib.maintainers; [ nequissimus vrthra ];
121 platforms = with lib.platforms; linux ++ darwin;
122 changelog = "https://invisible-island.net/xterm/xterm.log.html";