NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.66k stars 13.11k forks source link

tmux term info isn't defined on mac, so default tmux package has unexpected behavior #204144

Open michaelglass opened 1 year ago

michaelglass commented 1 year ago

Describe the bug

tmux 3.3 changes the default TERM to tmux-256color, which is invalid out of the box for Mac OS. See this note.

Steps To Reproduce

  1. install tmux from OS X and run tmux
  2. from tmux, run vi

Expected behavior

vi launches cleanly (this impacts a lot of terminal-things but vi is an obvious example)

Screenshots / actual behavior

CleanShot 2022-12-02 at 17 51 14@2x

Additional context

Sure there are many solutions. I see two:

Notify maintainers

@tobias-hammerschmidt @fpletz @SuperSandro2000 @rapenne-s (you are all heroes thank u!)

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

  ~ ❯ nix-shell -p nix-info --run "nix-info -m"                                                                                                                                      3m 4s
these 2 paths will be fetched (0.01 MiB download, 0.03 MiB unpacked):
  /nix/store/88v4kjvgwl71byfpvd0baviiq7l5appc-DarwinTools-1
  /nix/store/q5llpphnydm43r60h1rajw7wdjcb7z7i-nix-info
copying path '/nix/store/88v4kjvgwl71byfpvd0baviiq7l5appc-DarwinTools-1' from 'https://cache.nixos.org'...
copying path '/nix/store/q5llpphnydm43r60h1rajw7wdjcb7z7i-nix-info' from 'https://cache.nixos.org'...
 - system: `"x86_64-darwin"`
 - host os: `Darwin 22.2.0, macOS 10.16`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.11.1`
 - channels(michaelglass): `"darwin, nixpkgs-22.11, unstable"`
 - channels(root): `""`
 - nixpkgs: `/Users/michaelglass/.nix-defexpr/channels/nixpkgs`
SuperSandro2000 commented 1 year ago

Thats only a problem with tools linking against a very old ncurses but macos is using that. Just point TERMINFO_DIRS to the ncurses terminfo dir by nixpkgs. Unfortunately we cannot solve this on a package level. We could compile tmux on macos with the older term.

aaronjheng commented 1 year ago

We could compile tmux on macos with the older term.

Maybe on Linux too. Older Linux distros have no support for "tmux-256color". Right now, I use tmux.conf to resolve this issue.

set -g default-terminal "xterm-256color"
michaelglass commented 1 year ago

my workaround overlay looks like this:

self: super:

# this is a workaround for https://github.com/NixOS/nixpkgs/issues/204144
let
  tmuxWithScreen256color = super.tmux.overrideAttrs (oldAttrs: {
    configureFlags = oldAttrs.configureFlags ++ [ "--with-TERM=screen-256color" ];
  });
in
{
  tmux = tmuxWithScreen256color;
}