anchor.diff:    nativeBuildInputs = [
       pkg-config
       python3
  -    perl
  -    ncurses
  +    ncurses # tic for terminfo
     ];
   
  -  buildInputs = runtimeDeps;
  +  buildInputs = [
  +    fontconfig
  +    zlib
  +  ] ++ lib.optionals stdenv.isLinux [
  +    libX11
  +    libxcb
  +    libxkbcommon
  +    openssl
  +    wayland
  +    xcbutil
  +    xcbutilimage
  +    xcbutilkeysyms
  +    xcbutilwm # contains xcb-ewmh among others
  +  ] ++ lib.optionals stdenv.isDarwin [
  +    Cocoa
  +    CoreGraphics
  +    Foundation
  +    libiconv
  +  ];
   
     postInstall = ''
       # terminfo
  
positive.code: , Foundation
  , libiconv
  }:
  let
    runtimeDeps = [
      zlib
      fontconfig
      freetype
    ] ++ lib.optionals stdenv.isLinux [
      libX11
      xcbutil
      libxcb
      xcbutilimage
      xcbutilkeysyms
      xcbutilwm
      libxkbcommon
      dbus
      libglvnd
      egl-wayland
      wayland
      libGLU
      libGL
      openssl
    ] ++ lib.optionals stdenv.isDarwin [
      Foundation
      CoreGraphics
      Cocoa
      libiconv
    ];
  in
  
  rustPlatform.buildRustPackage rec {
    pname = "wezterm";
    version = "20210814-124438-54e29167";
  
    src = fetchFromGitHub {
      owner = "wez";
      repo = pname;
      rev = version;
      sha256 = "sha256-6HXTftgAs6JMzOMCY+laN74in8xfjE8yJc5xSl9PQCE=";
      fetchSubmodules = true;
    };
  
    outputs = [ "out" "terminfo" ];
  
    postPatch = ''
      echo ${version} > .tag
  
negative.code:     ln -s $out/bin/{wezterm,wezterm-mux-server,wezterm-gui,strip-ansi-escapes} "$OUT_APP"
    '';
  
    meta = with lib; {
      description = "A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust";
      homepage = "https://wezfurlong.org/wezterm";
      license = licenses.mit;
      maintainers = with maintainers; [ SuperSandro2000 ];
      platforms = platforms.unix;
    };
  }
  