1{ lib
2, stdenv
3, fetchurl
4, pkg-config
5, cmake
6, zlib
7, openssl
8, libsodium
9
10# for passthru.tests
11, ffmpeg
12, sshping
13, wireshark
14}:
15
16stdenv.mkDerivation rec {
17 pname = "libssh";
18 version = "0.10.5";
19
20 src = fetchurl {
21 url = "https://www.libssh.org/files/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
22 sha256 = "sha256-tg4v9/Nnue7itWNNOmMwPd/t4OahjfyojESodw5+QjQ=";
23 };
24
25 postPatch = ''
26 # Fix headers to use libsodium instead of NaCl
27 sed -i 's,nacl/,sodium/,g' ./include/libssh/curve25519.h src/curve25519.c
28 '';
29
30 # single output, otherwise cmake and .pc files point to the wrong directory
31 # outputs = [ "out" "dev" ];
32
33 buildInputs = [ zlib openssl libsodium ];
34
35 nativeBuildInputs = [ cmake pkg-config ];
36
37 passthru.tests = {
38 inherit ffmpeg sshping wireshark;
39 };
40
41 meta = with lib; {
42 description = "SSH client library";
43 homepage = "https://libssh.org";
44 license = licenses.lgpl2Plus;
45 maintainers = with maintainers; [ sander ];
46 platforms = platforms.all;
47 };
48}