2022-06-16 17:23:12 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, autoreconfHook
|
|
|
|
, bison
|
|
|
|
, libevent
|
2022-06-16 17:23:12 +00:00
|
|
|
, ncurses
|
|
|
|
, pkg-config
|
2023-07-15 17:15:38 +00:00
|
|
|
, runCommand
|
2023-02-02 18:25:31 +00:00
|
|
|
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
|
2022-11-27 09:42:12 +00:00
|
|
|
, withUtf8proc ? true, utf8proc # gets Unicode updates faster than glibc
|
2022-11-21 17:40:18 +00:00
|
|
|
, withUtempter ? stdenv.isLinux && !stdenv.hostPlatform.isMusl, libutempter
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
bashCompletion = fetchFromGitHub {
|
|
|
|
owner = "imomaliev";
|
|
|
|
repo = "tmux-bash-completion";
|
2020-11-03 02:18:15 +00:00
|
|
|
rev = "f5d53239f7658f8e8fbaf02535cc369009c436d6";
|
|
|
|
sha256 = "0sq2g3w0h3mkfa6qwqdw93chb5f1hgkz5vdl8yw8mxwdqwhsdprr";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "tmux";
|
2022-06-16 17:23:12 +00:00
|
|
|
version = "3.3a";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tmux";
|
|
|
|
repo = "tmux";
|
2023-07-15 17:15:38 +00:00
|
|
|
rev = finalAttrs.version;
|
2022-06-16 17:23:12 +00:00
|
|
|
sha256 = "sha256-SygHxTe7N4y7SdzKixPFQvqRRL57Fm8zWYHfTpW+yVY=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
patches = [
|
|
|
|
./CVE-2022-47016.patch
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
autoreconfHook
|
|
|
|
bison
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
ncurses
|
|
|
|
libevent
|
2022-06-26 10:26:21 +00:00
|
|
|
] ++ lib.optionals withSystemd [ systemd ]
|
2022-11-27 09:42:12 +00:00
|
|
|
++ lib.optionals withUtf8proc [ utf8proc ]
|
2022-11-21 17:40:18 +00:00
|
|
|
++ lib.optionals withUtempter [ libutempter ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--sysconfdir=/etc"
|
|
|
|
"--localstatedir=/var"
|
2022-06-26 10:26:21 +00:00
|
|
|
] ++ lib.optionals withSystemd [ "--enable-systemd" ]
|
2022-11-21 17:40:18 +00:00
|
|
|
++ lib.optionals withUtempter [ "--enable-utempter" ]
|
2022-11-27 09:42:12 +00:00
|
|
|
++ lib.optionals withUtf8proc [ "--enable-utf8proc" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/share/bash-completion/completions
|
|
|
|
cp -v ${bashCompletion}/completions/tmux $out/share/bash-completion/completions/tmux
|
2023-07-15 17:15:38 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
|
|
|
mkdir $out/nix-support
|
|
|
|
echo "${finalAttrs.passthru.terminfo}" >> $out/nix-support/propagated-user-env-packages
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
passthru = {
|
|
|
|
terminfo = runCommand "tmux-terminfo" { nativeBuildInputs = [ ncurses ]; } (if stdenv.isDarwin then ''
|
|
|
|
mkdir -p $out/share/terminfo/74
|
|
|
|
cp -v ${ncurses}/share/terminfo/74/tmux $out/share/terminfo/74
|
|
|
|
# macOS ships an old version (5.7) of ncurses which does not include tmux-256color so we need to provide it from our ncurses.
|
|
|
|
# However, due to a bug in ncurses 5.7, we need to first patch the terminfo before we can use it with macOS.
|
|
|
|
# https://gpanders.com/blog/the-definitive-guide-to-using-tmux-256color-on-macos/
|
|
|
|
tic -o $out/share/terminfo -x <(TERMINFO_DIRS=${ncurses}/share/terminfo infocmp -x tmux-256color | sed 's|pairs#0x10000|pairs#32767|')
|
|
|
|
'' else ''
|
|
|
|
mkdir -p $out/share/terminfo/t
|
|
|
|
ln -sv ${ncurses}/share/terminfo/t/{tmux,tmux-256color,tmux-direct} $out/share/terminfo/t
|
|
|
|
'');
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
2020-11-03 02:18:15 +00:00
|
|
|
homepage = "https://tmux.github.io/";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Terminal multiplexer";
|
2022-06-16 17:23:12 +00:00
|
|
|
longDescription = ''
|
|
|
|
tmux is intended to be a modern, BSD-licensed alternative to programs such as GNU screen. Major features include:
|
|
|
|
* A powerful, consistent, well-documented and easily scriptable command interface.
|
|
|
|
* A window may be split horizontally and vertically into panes.
|
|
|
|
* Panes can be freely moved and resized, or arranged into preset layouts.
|
|
|
|
* Support for UTF-8 and 256-colour terminals.
|
|
|
|
* Copy and paste with multiple buffers.
|
|
|
|
* Interactive menus to select windows, sessions or clients.
|
|
|
|
* Change the current window by searching for text in the target.
|
|
|
|
* Terminal locking, manually or after a timeout.
|
|
|
|
* A clean, easily extended, BSD-licensed codebase, under active development.
|
|
|
|
'';
|
2023-07-15 17:15:38 +00:00
|
|
|
changelog = "https://github.com/tmux/tmux/raw/${finalAttrs.version}/CHANGES";
|
2021-01-15 22:18:51 +00:00
|
|
|
license = lib.licenses.bsd3;
|
|
|
|
platforms = lib.platforms.unix;
|
2023-08-22 20:05:09 +00:00
|
|
|
mainProgram = "tmux";
|
2023-11-16 04:20:00 +00:00
|
|
|
maintainers = with lib.maintainers; [ thammers fpletz ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
})
|