nixos/amazon-image: fix eval (#378799)
[NixPkgs.git] / pkgs / applications / networking / ids / zeek / broker / default.nix
blobbd2591019582001bf30c11ca5880697d46c9e9ed
2   stdenv,
3   lib,
4   fetchFromGitHub,
5   cmake,
6   python3,
7   caf,
8   openssl,
9 }:
10 let
11   inherit (stdenv.hostPlatform) isStatic;
13   src-cmake = fetchFromGitHub {
14     owner = "zeek";
15     repo = "cmake";
16     rev = "1be78cc8a889d95db047f473a0f48e0baee49f33";
17     hash = "sha256-zcXWP8CHx0RSDGpRTrYD99lHlqSbvaliXrtFowPfhBk=";
18   };
19   src-3rdparty = fetchFromGitHub {
20     owner = "zeek";
21     repo = "zeek-3rdparty";
22     rev = "eb87829547270eab13c223e6de58b25bc9a0282e";
23     hash = "sha256-AVaKcRjF5ZiSR8aPSLBzSTeWVwGWW/aSyQJcN0Yhza0=";
24   };
25   caf' = caf.overrideAttrs (old: {
26     version = "unstable-2024-01-07-zeek";
27     src = fetchFromGitHub {
28       owner = "zeek";
29       repo = "actor-framework";
30       rev = "e3048cdd13e085c97870a55eb1f9de04e25320f3";
31       hash = "sha256-uisoYXiZbFQa/TfWGRrCJ23MX4bg8Ds86ffC8sZSRNQ=";
32     };
33     cmakeFlags = old.cmakeFlags ++ [
34       "-DCAF_ENABLE_TESTING=OFF"
35     ];
36     doCheck = false;
37   });
39 stdenv.mkDerivation rec {
40   pname = "zeek-broker";
41   version = "6.2.0";
42   outputs = [
43     "out"
44     "py"
45   ];
47   strictDeps = true;
49   src = fetchFromGitHub {
50     owner = "zeek";
51     repo = "broker";
52     rev = "v${version}";
53     hash = "sha256-SG5TzozKvYc7qcEPJgiEtsxgzdZbbJt90lmuUbCPyv0=";
54   };
55   postUnpack = ''
56     rmdir $sourceRoot/cmake $sourceRoot/3rdparty
57     ln -s ${src-cmake} ''${sourceRoot}/cmake
58     ln -s ${src-3rdparty} ''${sourceRoot}/3rdparty
60     # Refuses to build the bindings unless this file is present, but never
61     # actually uses it.
62     touch $sourceRoot/bindings/python/3rdparty/pybind11/CMakeLists.txt
63   '';
65   patches = [
66     ./0001-Fix-include-path-in-exported-CMake-targets.patch
67   ];
69   postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
70     substituteInPlace bindings/python/CMakeLists.txt --replace " -u -r" ""
71   '';
73   nativeBuildInputs = [
74     cmake
75     python3
76   ];
77   buildInputs = [
78     openssl
79     python3.pkgs.pybind11
80   ];
81   propagatedBuildInputs = [ caf' ];
83   cmakeFlags = [
84     "-DCAF_ROOT=${caf'}"
85     "-DENABLE_STATIC_ONLY:BOOL=${if isStatic then "ON" else "OFF"}"
86     "-DPY_MOD_INSTALL_DIR=${placeholder "py"}/${python3.sitePackages}/"
87   ];
89   meta = with lib; {
90     description = "Zeek's Messaging Library";
91     mainProgram = "broker-benchmark";
92     homepage = "https://github.com/zeek/broker";
93     license = licenses.bsd3;
94     platforms = platforms.unix;
95     maintainers = with maintainers; [ tobim ];
96   };