about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/tmux
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-08-08 16:04:42 +0000
committerAlyssa Ross <hi@alyssa.is>2023-08-13 06:35:37 +0000
commit12aaa58dac35800b5b7d77f81cf2a87c21ee55da (patch)
treebe0add9e5c22a85d20b5d78206aa74f956eb2a1b /nixpkgs/pkgs/tools/misc/tmux
parent45892a5591202f75a1c2f1ca7c62a92c7566e3c5 (diff)
parent5a8e9243812ba528000995b294292d3b5e120947 (diff)
downloadnixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar
nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.gz
nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.bz2
nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.lz
nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.xz
nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.tar.zst
nixlib-12aaa58dac35800b5b7d77f81cf2a87c21ee55da.zip
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/pkgs/applications/window-managers/sway/default.nix
	nixpkgs/pkgs/build-support/go/module.nix
	nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix
	nixpkgs/pkgs/development/libraries/mesa/default.nix
	nixpkgs/pkgs/servers/dict/dictd-db.nix

Link: https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/issues/391
Diffstat (limited to 'nixpkgs/pkgs/tools/misc/tmux')
-rw-r--r--nixpkgs/pkgs/tools/misc/tmux/default.nix29
1 files changed, 23 insertions, 6 deletions
diff --git a/nixpkgs/pkgs/tools/misc/tmux/default.nix b/nixpkgs/pkgs/tools/misc/tmux/default.nix
index a630dbc37411..deb2ff2c4e12 100644
--- a/nixpkgs/pkgs/tools/misc/tmux/default.nix
+++ b/nixpkgs/pkgs/tools/misc/tmux/default.nix
@@ -1,12 +1,12 @@
 { lib
 , stdenv
 , fetchFromGitHub
-, fetchpatch
 , autoreconfHook
 , bison
 , libevent
 , ncurses
 , pkg-config
+, runCommand
 , withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
 , withUtf8proc ? true, utf8proc # gets Unicode updates faster than glibc
 , withUtempter ? stdenv.isLinux && !stdenv.hostPlatform.isMusl, libutempter
@@ -23,7 +23,7 @@ let
 
 in
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   pname = "tmux";
   version = "3.3a";
 
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
   src = fetchFromGitHub {
     owner = "tmux";
     repo = "tmux";
-    rev = version;
+    rev = finalAttrs.version;
     sha256 = "sha256-SygHxTe7N4y7SdzKixPFQvqRRL57Fm8zWYHfTpW+yVY=";
   };
 
@@ -65,8 +65,25 @@ stdenv.mkDerivation rec {
   postInstall = ''
     mkdir -p $out/share/bash-completion/completions
     cp -v ${bashCompletion}/completions/tmux $out/share/bash-completion/completions/tmux
+  '' + lib.optionalString stdenv.isDarwin ''
+    mkdir $out/nix-support
+    echo "${finalAttrs.passthru.terminfo}" >> $out/nix-support/propagated-user-env-packages
   '';
 
+  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
+    '');
+  };
+
   meta = {
     homepage = "https://tmux.github.io/";
     description = "Terminal multiplexer";
@@ -82,9 +99,9 @@ stdenv.mkDerivation rec {
         * Terminal locking, manually or after a timeout.
         * A clean, easily extended, BSD-licensed codebase, under active development.
     '';
-    changelog = "https://github.com/tmux/tmux/raw/${version}/CHANGES";
+    changelog = "https://github.com/tmux/tmux/raw/${finalAttrs.version}/CHANGES";
     license = lib.licenses.bsd3;
     platforms = lib.platforms.unix;
-    maintainers = with lib.maintainers; [ thammers fpletz SuperSandro2000 srapenne ];
+    maintainers = with lib.maintainers; [ thammers fpletz srapenne ];
   };
-}
+})