about summary refs log tree commit diff
path: root/pkgs/by-name/op/openvas-smb/package.nix
blob: 16a912017975953ec16a8725bdf16172cd4d6833 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{ fetchFromGitHub
, fetchurl
, lib
, stdenv
, cmake
, git
, pkg-config
, glib
, gnutls
, perl
, heimdal
, popt
, libunistring
}:
let
  heimdalConfigHeader = fetchurl {
    url = "https://raw.githubusercontent.com/heimdal/heimdal/d8c10e68a61f10c8fca62b227a0766d294bda4a0/include/heim_threads.h";
    sha256 = "08345hkb5jbdcgh2cx3d624w4c8wxmnnsjxlw46wsnm39k4l0ihw";
  };
in
stdenv.mkDerivation rec {
  pname = "openvas-smb";
  version = "22.5.6";

  src = fetchFromGitHub {
    owner = "greenbone";
    repo = "openvas-smb";
    rev = "refs/tags/v${version}";
    hash = "sha256-wnlBOHYOTWNbwzoHCpsXbuhp0uH3wBH6+Oo4Y+zSsfg=";
  };

  nativeBuildInputs = [
    cmake
    git
    pkg-config
  ];

  buildInputs = [
    glib
    gnutls
    perl
    heimdal
    popt
    libunistring
  ];

  # The pkg expects the heimdal headers to be in a "heimdal" folder, which is the case on
  # debian, but not on nix. Additionally some heimdal header names have the same names
  # as kerberos header names, so the old include path is removed.
  preConfigure = ''
    mkdir -p include

    # symlink to change include path for heimdal headers from "heim_etc.h" to "heimdal/heim_etc.h"
    ln -s ${heimdal.dev}/include include/heimdal
    remove="-isystem ${heimdal.dev}/include "
    NIX_CFLAGS_COMPILE=''${NIX_CFLAGS_COMPILE//"''$remove"/}
    NIX_CFLAGS_COMPILE+=" -isystem $(pwd)/include";

    # add default config header for heimdal
    cp ${heimdalConfigHeader} include/heim_threads.h
  '';

  meta = with lib; {
    description = "SMB module for Greenbone Community Edition";
    homepage = "https://github.com/greenbone/openvas-smb";
    license = licenses.gpl2Only;
    maintainers = with maintainers; [ mi-ael ];
    mainProgram = "wmic";
    platforms = platforms.unix;
  };
}