summary refs log tree commit diff
path: root/pkgs/tools/misc/minicom
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/misc/minicom')
-rw-r--r--pkgs/tools/misc/minicom/default.nix53
-rw-r--r--pkgs/tools/misc/minicom/xminicom_terminal_paths.patch79
2 files changed, 132 insertions, 0 deletions
diff --git a/pkgs/tools/misc/minicom/default.nix b/pkgs/tools/misc/minicom/default.nix
new file mode 100644
index 00000000000..d237c3b7fdd
--- /dev/null
+++ b/pkgs/tools/misc/minicom/default.nix
@@ -0,0 +1,53 @@
+{ lib, stdenv, fetchgit, autoreconfHook, makeWrapper, pkg-config
+, lrzsz, ncurses, libiconv }:
+
+stdenv.mkDerivation {
+  pname = "minicom";
+  version = "2.7.1";
+
+  # The repository isn't tagged properly, so we need to use commit refs
+  src = fetchgit {
+    url    = "https://salsa.debian.org/minicom-team/minicom.git";
+    rev    = "6ea8033b6864aa35d14fb8b87e104e4f783635ce";
+    sha256 = "0j95727xni4r122dalp09963gvc1nqa18l1d4wzz8746kw5s2rrb";
+  };
+
+  buildInputs = [ ncurses ] ++ lib.optional stdenv.isDarwin libiconv;
+
+  nativeBuildInputs = [ autoreconfHook makeWrapper pkg-config ];
+
+  enableParallelBuilding = true;
+
+  configureFlags = [
+    "--sysconfdir=/etc"
+    "--enable-lock-dir=/var/lock"
+  ];
+
+  patches = [ ./xminicom_terminal_paths.patch ];
+
+  preConfigure = ''
+    # Have `configure' assume that the lock directory exists.
+    substituteInPlace configure \
+      --replace 'test -d $UUCPLOCK' true
+  '';
+
+  postInstall = ''
+    for f in $out/bin/*minicom ; do
+      wrapProgram $f \
+        --prefix PATH : ${lib.makeBinPath [ lrzsz ]}:$out/bin
+    done
+  '';
+
+  meta = with lib; {
+    description = "Modem control and terminal emulation program";
+    homepage = "https://salsa.debian.org/minicom-team/minicom";
+    license = licenses.gpl2;
+    longDescription = ''
+      Minicom is a menu driven communications program. It emulates ANSI
+      and VT102 terminals. It has a dialing directory and auto zmodem
+      download.
+    '';
+    maintainers = with maintainers; [ peterhoeg ];
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/pkgs/tools/misc/minicom/xminicom_terminal_paths.patch b/pkgs/tools/misc/minicom/xminicom_terminal_paths.patch
new file mode 100644
index 00000000000..18535253d9f
--- /dev/null
+++ b/pkgs/tools/misc/minicom/xminicom_terminal_paths.patch
@@ -0,0 +1,79 @@
+diff --git a/src/xminicom b/src/xminicom
+index a59aa08..cef153b 100755
+--- a/src/xminicom
++++ b/src/xminicom
+@@ -7,57 +7,39 @@
+ #
+ # version	$Id: xminicom,v 1.4 2008-06-09 20:48:35 al-guest Exp $
+
+-findcmd()
+-{
+-  IFS=:
+-  for i in $PATH
+-  do
+-	if [ -x $i\/$1 ]
+-	then
+-		result=$i\/$1
+-		IFS=
+-		return 0
+-	fi
+-  done
+-  result=
+-  IFS=
+-  return 1
++findcmd() {
++  result=$(command -v $1)
+ }
+
+-if findcmd x-terminal-emulator
+-then
++if findcmd x-terminal-emulator ; then
+   exec $result -T minicom -e "if ! minicom -m -c on $*; then echo Press ENTER to continue...; read; fi"
+   exit 1
+ fi
+
+-if findcmd color_xterm
+-then
++if findcmd konsole ; then
++  exec $result -T minicom -geometry 80x25 -e minicom -m -c on "$@"
++  exit 1
++fi
++
++if findcmd gnome-terminal ; then
++  exec $result -T minicom -geometry 80x25 -e "if ! minicom -m -c on $*; then echo Press ENTER to continue...; read; fi"
++  exit 1
++fi
++
++if findcmd color_xterm ; then
+   exec $result -T minicom -bg black -fg grey -n minicom -geometry 80x25 -e "if ! minicom -m -c on $*; then echo Press ENTER to continue...; read; fi"
+   exit 1
+ fi
+
+-if findcmd rxvt
+-then
++if findcmd rxvt ; then
+   exec $result -bg black -fg grey -n minicom -T minicom -sl 0 -geometry 80x25 -e "if ! minicom -m -c on $*; then echo Press ENTER to continue...; read; fi"
+   exit 1
+ fi
+
+-if findcmd kterm
+-then
++if findcmd xterm ; then
+   exec $result -T minicom -n minicom -geometry 80x25 -e "if ! minicom -m -c on $*; then echo Press ENTER to continue...; read; fi"
+   exit 1
+ fi
+
+-if findcmd xterm
+-then
+-  if [ -f /etc/debian_version ]
+-  then
+-  exec $result -T minicom -n minicom -bg black -fg grey -geometry 80x25 -e "if ! minicom -m -c on $*; then echo Press ENTER to continue...; read; fi"
+-  else
+-  exec $result -T minicom -n minicom -geometry 80x25 -e "if ! minicom -m -c on $*; then echo Press ENTER to continue...; read; fi"
+-  fi
+-  exit 1
+-fi
+-
+-echo "xminicom: rxvt, color_xterm or xterm NOT found!" 1>&2
++echo "xminicom: konsole, gnome-terminal, rxvt, color_xterm or xterm NOT found!" 1>&2
+ exit 1