about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2024-06-25 23:26:59 +0200
committerGitHub <noreply@github.com>2024-06-25 23:26:59 +0200
commit406f733caba084cb5f3288e80ddcdea9d38ed6fb (patch)
tree1bbedc373c0206199775bf63a507db02017c91f6 /pkgs
parentec13fea4b757262398df0ae75839794f53237792 (diff)
parent6324bc777cfe340911fc7a48eb0ce66e52a89052 (diff)
Merge pull request #308588 from mi-ael/init-openvas-smb
openvas-smb: init at 22.5.6
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/by-name/op/openvas-smb/package.nix71
1 files changed, 71 insertions, 0 deletions
diff --git a/pkgs/by-name/op/openvas-smb/package.nix b/pkgs/by-name/op/openvas-smb/package.nix
new file mode 100644
index 0000000000000..16a9120179759
--- /dev/null
+++ b/pkgs/by-name/op/openvas-smb/package.nix
@@ -0,0 +1,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;
+  };
+}