Added mosh as a package

This commit is contained in:
Julien Malka 2021-12-26 21:07:40 +01:00
parent 0b006a916a
commit 1689efee41
No known key found for this signature in database
GPG key ID: 3C68E13964FEA07F
5 changed files with 50 additions and 43 deletions

View file

@ -43,6 +43,9 @@
(builtins.attrNames (builtins.readDir ./modules)));
nixosConfigurations = builtins.mapAttrs (name: value: (mkMachine name value self.nixosModules)) (importConfig ./machines);
packages."x86_64-linux".tinystatus = import ./packages/tinystatus { inherit pkgs; };
packages."x86_64-linux" = {
tinystatus = import ./packages/tinystatus { inherit pkgs; };
mosh = pkgs.callPackage ./packages/mosh {};
};
};
}

View file

@ -0,0 +1,20 @@
diff --git a/configure.ac b/configure.ac
index 3ad983d..ff8ff96 100644
--- a/configure.ac
+++ b/configure.ac
@@ -476,13 +476,7 @@ AS_IF([echo "$protobuf_LIBS" | grep -q -- -pthread],
# Bash completion needs to ask where it goes if >= 2.0 is installed.
AS_IF([test "$install_completion" != no],
- [PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0],
- [if test "$prefix" = "NONE"; then
- completions="`pkg-config --variable=completionsdir bash-completion`"
- else
- completions="`pkg-config --define-variable=prefix=$prefix --variable=completionsdir bash-completion`"
- fi],
- [completions="${sysconfdir}/bash_completion.d"])
+ [completions="`pkg-config --define-variable=datadir=$datadir --variable=completionsdir bash-completion`"]
AC_SUBST([completions])])
AC_CONFIG_FILES([

View file

@ -1,20 +1,20 @@
#{ lib, stdenv, fetchFromGithub, fetchpatch, zlib, protobuf, ncurses, pkg-config
#, makeWrapper, perlPackages, openssl, autoreconfHook, openssh, bash-completion
#, withUtempter ? stdenv.isLinux, libutempter }:
{ pkgs, lib, stdenv, fetchFromGithub, fetchpatch, zlib, protobuf, ncurses, pkg-config
, makeWrapper, perlPackages, openssl, autoreconfHook, openssh, bash-completion
, withUtempter ? stdenv.isLinux, libutempter }:
stdenv.mkDerivation rec {
pname = "mosh";
version = "1.3.2";
src = fetchFromGitHub {
src = pkgs.fetchFromGitHub {
owner = "mobile-shell";
repo = pname;
rev = "378dfa6aa5778cf168646ada7f52b6f4a8ec8e41";
sha256 = "05hjhlp6lk8yjcy59zywpf0r6s0h0b9zxq0lw66dh9x8vxrhaq6s";
sha256 = "LJssBMrICVgaZtTvZTO6bYMFO4fQ330lIUkWzDSyf7o=";
};
nativeBuildInputs = [ autoreconfHook pkg-config makeWrapper ];
buildInputs = [ protobuf ncurses zlib openssl bash-completion ]
buildInputs = [ protobuf ncurses zlib openssl ]
++ (with perlPackages; [ perl IOTty ])
++ lib.optional withUtempter libutempter;
@ -22,31 +22,16 @@ stdenv.mkDerivation rec {
patches = [
./ssh_path.patch
./mosh-client_path.patch
./utempter_path.patch
# Fix w/c++17, ::bind vs std::bind
(fetchpatch {
url = "https://github.com/mobile-shell/mosh/commit/e5f8a826ef9ff5da4cfce3bb8151f9526ec19db0.patch";
sha256 = "15518rb0r5w1zn4s6981bf1sz6ins6gpn2saizfzhmr13hw4gmhm";
})
# Fix build with bash-completion 2.10
./bash_completion_datadir.patch
];
postPatch = ''
# Fix build with Xcode 12.5 toolchain/case-insensitive filesystems
# Backport of https://github.com/mobile-shell/mosh/commit/12199114fe4234f791ef4c306163901643b40538;
# remove on next upstream release.
patch -p0 < ${fetchpatch {
url = "https://raw.githubusercontent.com/macports/macports-ports/70ca3f65e622c17582fd938602d800157ed951c3/net/mosh/files/patch-version-subdir.diff";
sha256 = "1yyh6d07y9zbdx4fb0r56zkq9nd9knwzj22v4dfi55k4k42qxapd";
}}
substituteInPlace scripts/mosh.pl \
--subst-var-by ssh "${openssh}/bin/ssh" \
--subst-var-by mosh-client "$out/bin/mosh-client"
preConfigure = ''
./autogen.sh
'';
NIX_CFLAGS_COMPILE = "-O2";
configureFlags = [ "--enable-completion" ]
++ lib.optional withUtempter "--with-utempter";
@ -74,3 +59,4 @@ stdenv.mkDerivation rec {
}

View file

@ -0,0 +1,14 @@
diff --git i/scripts/mosh.pl w/scripts/mosh.pl
index c511482..55bf5f3 100755
--- i/scripts/mosh.pl
+++ w/scripts/mosh.pl
@@ -66,7 +66,7 @@ my $use_remote_ip = 'proxy';
my $family = 'prefer-inet';
my $port_request = undef;
-my @ssh = ('ssh');
+my @ssh = ('@ssh@');
my $term_init = 1;

View file

@ -26,23 +26,7 @@ in
(final: prev:
{
tinystatus = prev.pkgs.callPackage ./packages/tinystatus {};
mosh = prev.mosh.overrideAttrs (old: {
patches = (prev.lib.take 1 old.patches) ++ (prev.lib.sublist 4 4 old.patches);
postPatch = '''';
buildInputs = with prev; [ protobuf ncurses zlib openssl ]
++ (with perlPackages; [ perl IOTty ])
++ lib.optional true libutempter;
preConfigure = ''
./autogen.sh
'';
NIX_CFLAGS_COMPILE = "-O2";
src = prev.fetchFromGitHub {
owner = "mobile-shell";
repo = "mosh";
rev = "378dfa6aa5778cf168646ada7f52b6f4a8ec8e41";
sha256 = "LJssBMrICVgaZtTvZTO6bYMFO4fQ330lIUkWzDSyf7o=";
};
});
mosh = prev.pkgs.callPackage ./packages/mosh {};
})
];
}