11 , withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
12 , withUtf8proc ? true, utf8proc # gets Unicode updates faster than glibc
13 , withUtempter ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isMusl, libutempter
19 bashCompletion = fetchFromGitHub {
21 repo = "tmux-bash-completion";
22 rev = "f5d53239f7658f8e8fbaf02535cc369009c436d6";
23 sha256 = "0sq2g3w0h3mkfa6qwqdw93chb5f1hgkz5vdl8yw8mxwdqwhsdprr";
28 stdenv.mkDerivation (finalAttrs: {
32 outputs = [ "out" "man" ];
34 src = fetchFromGitHub {
37 rev = finalAttrs.version;
38 hash = "sha256-Z9XHpyh4Y6iBI4+SfFBCGA8huFJpRFZy9nEB7+WQVJE=";
50 ] ++ lib.optionals withSystemd [ systemd ]
51 ++ lib.optionals withUtf8proc [ utf8proc ]
52 ++ lib.optionals withUtempter [ libutempter ];
56 "--localstatedir=/var"
57 ] ++ lib.optionals withSystemd [ "--enable-systemd" ]
58 ++ lib.optionals withSixel [ "--enable-sixel" ]
59 ++ lib.optionals withUtempter [ "--enable-utempter" ]
60 ++ lib.optionals withUtf8proc [ "--enable-utf8proc" ];
62 enableParallelBuilding = true;
65 mkdir -p $out/share/bash-completion/completions
66 cp -v ${bashCompletion}/completions/tmux $out/share/bash-completion/completions/tmux
67 '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
68 mkdir $out/nix-support
69 echo "${finalAttrs.passthru.terminfo}" >> $out/nix-support/propagated-user-env-packages
73 terminfo = runCommand "tmux-terminfo" { nativeBuildInputs = [ ncurses ]; } (if stdenv.hostPlatform.isDarwin then ''
74 mkdir -p $out/share/terminfo/74
75 cp -v ${ncurses}/share/terminfo/74/tmux $out/share/terminfo/74
76 # macOS ships an old version (5.7) of ncurses which does not include tmux-256color so we need to provide it from our ncurses.
77 # However, due to a bug in ncurses 5.7, we need to first patch the terminfo before we can use it with macOS.
78 # https://gpanders.com/blog/the-definitive-guide-to-using-tmux-256color-on-macos/
79 tic -o $out/share/terminfo -x <(TERMINFO_DIRS=${ncurses}/share/terminfo infocmp -x tmux-256color | sed 's|pairs#0x10000|pairs#32767|')
81 mkdir -p $out/share/terminfo/t
82 ln -sv ${ncurses}/share/terminfo/t/{tmux,tmux-256color,tmux-direct} $out/share/terminfo/t
87 homepage = "https://tmux.github.io/";
88 description = "Terminal multiplexer";
90 tmux is intended to be a modern, BSD-licensed alternative to programs such as GNU screen. Major features include:
91 * A powerful, consistent, well-documented and easily scriptable command interface.
92 * A window may be split horizontally and vertically into panes.
93 * Panes can be freely moved and resized, or arranged into preset layouts.
94 * Support for UTF-8 and 256-colour terminals.
95 * Copy and paste with multiple buffers.
96 * Interactive menus to select windows, sessions or clients.
97 * Change the current window by searching for text in the target.
98 * Terminal locking, manually or after a timeout.
99 * A clean, easily extended, BSD-licensed codebase, under active development.
101 changelog = "https://github.com/tmux/tmux/raw/${finalAttrs.version}/CHANGES";
102 license = lib.licenses.bsd3;
103 platforms = lib.platforms.unix;
104 mainProgram = "tmux";
105 maintainers = with lib.maintainers; [ thammers fpletz ];