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