nixos/programs.mosh: refactor
Adds programs.mosh.withUtempter (default: true). The option enables -with-utempter for mosh, allowing it to write to /var/run/utmp and thus making connected sessions appear in the output of `who -a`. For that, a guid-wrapper is required. Also, the path to the `utempter` was hardcoded in the resulting binary until now (so it could never been found), thus, libutempter was patched accordingly to point to /run/wrappers/bin/utempter which at least works when the wrapper is configured.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{ stdenv, fetchurl, zlib, protobuf, ncurses, pkgconfig, IOTty
|
||||
, makeWrapper, perl, openssl, autoreconfHook, openssh, bash-completion }:
|
||||
{ lib, stdenv, fetchurl, zlib, protobuf, ncurses, pkgconfig, IOTty
|
||||
, makeWrapper, perl, openssl, autoreconfHook, openssh, bash-completion
|
||||
, libutempter ? null, withUtempter ? stdenv.isLinux }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "mosh-1.3.2";
|
||||
@@ -10,15 +11,15 @@ stdenv.mkDerivation rec {
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ autoreconfHook pkgconfig ];
|
||||
buildInputs = [ protobuf ncurses zlib IOTty makeWrapper perl openssl bash-completion ];
|
||||
buildInputs = [ protobuf ncurses zlib IOTty makeWrapper perl openssl bash-completion ] ++ lib.optional withUtempter libutempter;
|
||||
|
||||
patches = [ ./ssh_path.patch ];
|
||||
patches = [ ./ssh_path.patch ./utempter_path.patch ];
|
||||
postPatch = ''
|
||||
substituteInPlace scripts/mosh.pl \
|
||||
--subst-var-by ssh "${openssh}/bin/ssh"
|
||||
'';
|
||||
|
||||
configureFlags = [ "--enable-completion" ];
|
||||
configureFlags = [ "--enable-completion" ] ++ lib.optional withUtempter "--with-utempter";
|
||||
|
||||
postInstall = ''
|
||||
wrapProgram $out/bin/mosh --prefix PERL5LIB : $PERL5LIB
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
diff -ur mosh-1.3.2/src/frontend/mosh-server.cc mosh-1.3.2.patched/src/frontend/mosh-server.cc
|
||||
--- mosh-1.3.2/src/frontend/mosh-server.cc 2017-07-22 23:14:53.000000000 +0200
|
||||
+++ mosh-1.3.2.patched/src/frontend/mosh-server.cc 2018-06-06 10:45:50.725352804 +0200
|
||||
@@ -351,6 +351,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
+#ifdef HAVE_UTEMPTER
|
||||
+ utempter_set_helper( "utempter" );
|
||||
+#endif
|
||||
+
|
||||
try {
|
||||
return run_server( desired_ip, desired_port, command_path, command_argv, colors, verbose, with_motd );
|
||||
} catch ( const Network::NetworkException &e ) {
|
||||
Reference in New Issue
Block a user