summary refs log tree commit diff
path: root/pkgs/tools/misc/byobu/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-08-04 10:43:07 +0000
committerAlyssa Ross <hi@alyssa.is>2021-08-04 10:43:07 +0000
commit62614cbef7da005c1eda8c9400160f6bcd6546b8 (patch)
treec2630f69080637987b68acb1ee8676d2681fe304 /pkgs/tools/misc/byobu/default.nix
parentd9c82ed3044c72cecf01c6ea042489d30914577c (diff)
parente24069138dfec3ef94f211f1da005bb5395adc11 (diff)
downloadnixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.gz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.bz2
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.lz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.xz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.zst
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.zip
Merge branch 'nixpkgs-update' into master
Diffstat (limited to 'pkgs/tools/misc/byobu/default.nix')
-rw-r--r--pkgs/tools/misc/byobu/default.nix65
1 files changed, 52 insertions, 13 deletions
diff --git a/pkgs/tools/misc/byobu/default.nix b/pkgs/tools/misc/byobu/default.nix
index ad17c5edd6e..ffe3fd0fe16 100644
--- a/pkgs/tools/misc/byobu/default.nix
+++ b/pkgs/tools/misc/byobu/default.nix
@@ -1,5 +1,10 @@
-{ stdenv, fetchurl, python3, perl, textual-window-manager }:
+{ lib, stdenv, fetchurl, makeWrapper
+, ncurses, python3, perl, textual-window-manager
+, gettext, vim, bc, screen }:
 
+let
+  pythonEnv = python3.withPackages (ps: with ps; [ snack ]);
+in
 stdenv.mkDerivation rec {
   version = "5.133";
   name = "byobu-" + version;
@@ -11,26 +16,60 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  buildInputs = [ python3 perl ];
-  propagatedBuildInputs = [ textual-window-manager ];
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ perl gettext ];
+  propagatedBuildInputs = [ textual-window-manager screen ];
 
-  meta = {
+  postPatch = ''
+    substituteInPlace usr/bin/byobu-export.in \
+      --replace "gettext" "${gettext}/bin/gettext"
+    substituteInPlace usr/lib/byobu/menu \
+      --replace "gettext" "${gettext}/bin/gettext"
+  '';
+
+  postInstall = ''
+    # Byobu does not compile its po files for some reason
+    for po in po/*.po; do
+      lang=''${po#po/}
+      lang=''${lang%.po}
+      # Path where byobu looks for translations as observed in the source code and strace
+      mkdir -p $out/share/byobu/po/$lang/LC_MESSAGES/
+      msgfmt $po -o $out/share/byobu/po/$lang/LC_MESSAGES/byobu.mo
+    done
+
+    # Override the symlinks otherwise they mess with the wrapping
+    cp --remove-destination $out/bin/byobu $out/bin/byobu-screen
+    cp --remove-destination $out/bin/byobu $out/bin/byobu-tmux
+
+    for i in $out/bin/byobu*; do
+      # We don't use the usual ".$package-wrapped" because arg0 within the shebang scripts
+      # points to the filename and byobu matches against this to know which backend
+      # to start with
+      file=".$(basename $i)"
+      mv $i $out/bin/$file
+      makeWrapper "$out/bin/$file" "$out/bin/$(basename $i)" --argv0 $(basename $i) \
+        --set BYOBU_PATH ${lib.escapeShellArg (lib.makeBinPath [ vim bc ])} \
+        --set BYOBU_PYTHON "${pythonEnv}/bin/python"
+    done
+  '';
+
+  meta = with lib; {
     homepage = "https://launchpad.net/byobu/";
     description = "Text-based window manager and terminal multiplexer";
 
     longDescription =
-      ''Byobu is a GPLv3 open source text-based window manager and terminal multiplexer. 
-        It was originally designed to provide elegant enhancements to the otherwise functional, 
-        plain, practical GNU Screen, for the Ubuntu server distribution. 
-        Byobu now includes an enhanced profiles, convenient keybindings, 
-        configuration utilities, and toggle-able system status notifications for both 
-        the GNU Screen window manager and the more modern Tmux terminal multiplexer, 
+      ''Byobu is a GPLv3 open source text-based window manager and terminal multiplexer.
+        It was originally designed to provide elegant enhancements to the otherwise functional,
+        plain, practical GNU Screen, for the Ubuntu server distribution.
+        Byobu now includes an enhanced profiles, convenient keybindings,
+        configuration utilities, and toggle-able system status notifications for both
+        the GNU Screen window manager and the more modern Tmux terminal multiplexer,
         and works on most Linux, BSD, and Mac distributions.
       '';
 
-    license = stdenv.lib.licenses.gpl3;
+    license = licenses.gpl3;
 
-    platforms = stdenv.lib.platforms.unix;
-    maintainers = [ stdenv.lib.maintainers.qknight ];
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ qknight berbiche ];
   };
 }