summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Berbiche <nicolas@normie.dev>2020-10-26 20:52:46 -0400
committerNicolas Berbiche <nicolas@normie.dev>2020-10-26 20:52:46 -0400
commit3ac1ffe8b22ce0db0a112a9e472aa90f0e946c1f (patch)
treed5681fd5270e7f0bbef14beb1501b6ea6e6a8c23
parentf6cd17269ea0076631938886d8ed4764c71d7731 (diff)
downloadnixpkgs-3ac1ffe8b22ce0db0a112a9e472aa90f0e946c1f.tar
nixpkgs-3ac1ffe8b22ce0db0a112a9e472aa90f0e946c1f.tar.gz
nixpkgs-3ac1ffe8b22ce0db0a112a9e472aa90f0e946c1f.tar.bz2
nixpkgs-3ac1ffe8b22ce0db0a112a9e472aa90f0e946c1f.tar.lz
nixpkgs-3ac1ffe8b22ce0db0a112a9e472aa90f0e946c1f.tar.xz
nixpkgs-3ac1ffe8b22ce0db0a112a9e472aa90f0e946c1f.tar.zst
nixpkgs-3ac1ffe8b22ce0db0a112a9e472aa90f0e946c1f.zip
byobu: add support for the screen backend
-rw-r--r--pkgs/development/libraries/newt/default.nix12
-rw-r--r--pkgs/tools/misc/byobu/default.nix65
-rw-r--r--pkgs/top-level/python-packages.nix2
3 files changed, 64 insertions, 15 deletions
diff --git a/pkgs/development/libraries/newt/default.nix b/pkgs/development/libraries/newt/default.nix
index 0dade017d08..41d9671b204 100644
--- a/pkgs/development/libraries/newt/default.nix
+++ b/pkgs/development/libraries/newt/default.nix
@@ -1,5 +1,8 @@
-{ fetchurl, stdenv, slang, popt }:
+{ lib, fetchurl, stdenv, slang, popt, python }:
 
+let
+  pythonIncludePath = "${lib.getDev python}/include/python";
+in
 stdenv.mkDerivation rec {
   pname = "newt";
   version = "0.52.21";
@@ -11,9 +14,14 @@ stdenv.mkDerivation rec {
 
   patchPhase = ''
     sed -i -e s,/usr/bin/install,install, -e s,-I/usr/include/slang,, Makefile.in po/Makefile
+
+    substituteInPlace configure \
+      --replace "/usr/include/python" "${pythonIncludePath}"
+    substituteInPlace configure.ac \
+      --replace "/usr/include/python" "${pythonIncludePath}"
   '';
 
-  buildInputs = [ slang popt ];
+  buildInputs = [ slang popt python ];
 
   NIX_LDFLAGS = "-lncurses";
 
diff --git a/pkgs/tools/misc/byobu/default.nix b/pkgs/tools/misc/byobu/default.nix
index ad17c5edd6e..695ae54d876 100644
--- a/pkgs/tools/misc/byobu/default.nix
+++ b/pkgs/tools/misc/byobu/default.nix
@@ -1,5 +1,11 @@
-{ stdenv, fetchurl, python3, perl, textual-window-manager }:
+{ stdenv, fetchurl, makeWrapper
+, ncurses, python3, perl, textual-window-manager
+, gettext, vim, bc, screen }:
 
+let
+  inherit (stdenv) lib;
+  pythonEnv = python3.withPackages (ps: with ps; [ snack ]);
+in
 stdenv.mkDerivation rec {
   version = "5.133";
   name = "byobu-" + version;
@@ -11,26 +17,59 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  buildInputs = [ python3 perl ];
-  propagatedBuildInputs = [ textual-window-manager ];
+  buildInputs = [ perl makeWrapper 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 stdenv.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 ];
   };
 }
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index aab9f760dba..8f65c240999 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -6610,6 +6610,8 @@ in {
 
   smugpy = callPackage ../development/python-modules/smugpy { };
 
+  snack = toPythonModule (pkgs.newt.override { inherit (self) python; });
+
   snakebite = callPackage ../development/python-modules/snakebite { };
 
   snakeviz = callPackage ../development/python-modules/snakeviz { };