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.6";
19
20 src = fetchurl {
21 url = "https://www.libssh.org/files/${lib.versions.majorMinor version}/libssh-${version}.tar.xz";
22 hash = "sha256-GGHUmPW28XQbarxz5ghHhJHtz5ydS2Yw7vbnRZbencE=";
23 };
24
25 # Do not split 'dev' output until lib/cmake/libssh/libssh-config.cmake
26 # is fixed to point INTERFACE_INCLUDE_DIRECTORIES to .dev output.
27 # Otherwise it breaks `plasma5Packages.kio-extras`:
28 # https://hydra.nixos.org/build/221540008/nixlog/3/tail
29 #outputs = [ "out" "dev" ];
30
31 postPatch = ''
32 # Fix headers to use libsodium instead of NaCl
33 sed -i 's,nacl/,sodium/,g' ./include/libssh/curve25519.h src/curve25519.c
34 '';
35
36 # Don’t build examples, which are not installed and require additional dependencies not
37 # included in `buildInputs` such as libX11.
38 cmakeFlags = [ "-DWITH_EXAMPLES=OFF" ];
39
40 # single output, otherwise cmake and .pc files point to the wrong directory
41 # outputs = [ "out" "dev" ];
42
43 buildInputs = [ zlib openssl libsodium ];
44
45 nativeBuildInputs = [ cmake pkg-config ];
46
47 passthru.tests = {
48 inherit ffmpeg sshping wireshark;
49 };
50
51 meta = with lib; {
52 description = "SSH client library";
53 homepage = "https://libssh.org";
54 license = licenses.lgpl2Plus;
55 maintainers = with maintainers; [ sander ];
56 platforms = platforms.all;
57 };
58}