summary refs log tree commit diff
path: root/pkgs/development/libraries/libssh/default.nix
blob: 504cc76269ce5b8d023ee40193626fd1f78fb869 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{ lib
, stdenv
, fetchurl
, pkg-config
, cmake
, zlib
, openssl
, libsodium

# for passthru.tests
, ffmpeg
, sshping
, wireshark
}:

stdenv.mkDerivation rec {
  pname = "libssh";
  version = "0.10.5";

  src = fetchurl {
    url = "https://www.libssh.org/files/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
    sha256 = "sha256-tg4v9/Nnue7itWNNOmMwPd/t4OahjfyojESodw5+QjQ=";
  };

  outputs = [ "out" "dev" ];

  postPatch = ''
    # Fix headers to use libsodium instead of NaCl
    sed -i 's,nacl/,sodium/,g' ./include/libssh/curve25519.h src/curve25519.c
  '';

  # Don’t build examples, which are not installed and require additional dependencies not
  # included in `buildInputs` such as libX11.
  cmakeFlags = [ "-DWITH_EXAMPLES=OFF" ];

  # single output, otherwise cmake and .pc files point to the wrong directory
  # outputs = [ "out" "dev" ];

  buildInputs = [ zlib openssl libsodium ];

  nativeBuildInputs = [ cmake pkg-config ];

  passthru.tests = {
    inherit ffmpeg sshping wireshark;
  };

  meta = with lib; {
    description = "SSH client library";
    homepage = "https://libssh.org";
    license = licenses.lgpl2Plus;
    maintainers = with maintainers; [ sander ];
    platforms = platforms.all;
  };
}