diff options
Diffstat (limited to 'pkgs/by-name/an/ananicy-cpp/package.nix')
-rw-r--r-- | pkgs/by-name/an/ananicy-cpp/package.nix | 65 |
1 files changed, 37 insertions, 28 deletions
diff --git a/pkgs/by-name/an/ananicy-cpp/package.nix b/pkgs/by-name/an/ananicy-cpp/package.nix index a17e199a5ca71..e34bebff8f262 100644 --- a/pkgs/by-name/an/ananicy-cpp/package.nix +++ b/pkgs/by-name/an/ananicy-cpp/package.nix @@ -1,29 +1,31 @@ -{ lib -, clangStdenv -, fetchFromGitLab -, fetchpatch -, cmake -, pkg-config -, spdlog -, nlohmann_json -, systemd -, libbpf -, elfutils -, bpftools -, pcre2 -, zlib +{ + lib, + clangStdenv, + fetchFromGitLab, + fetchpatch, + cmake, + pkg-config, + spdlog, + nlohmann_json, + systemd, + libbpf, + elfutils, + bpftools, + pcre2, + zlib, + withBpf ? true, }: -clangStdenv.mkDerivation rec { +clangStdenv.mkDerivation (finalAttrs: { pname = "ananicy-cpp"; version = "1.1.1"; src = fetchFromGitLab { owner = "ananicy-cpp"; repo = "ananicy-cpp"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; fetchSubmodules = true; - sha256 = "sha256-oPinSc00+Z6SxjfTh7DttcXSjsLv1X0NI+O37C8M8GY="; + hash = "sha256-oPinSc00+Z6SxjfTh7DttcXSjsLv1X0NI+O37C8M8GY="; }; patches = [ @@ -41,6 +43,7 @@ clangStdenv.mkDerivation rec { nativeBuildInputs = [ cmake pkg-config + ] ++ lib.optionals withBpf [ bpftools ]; @@ -49,23 +52,29 @@ clangStdenv.mkDerivation rec { spdlog nlohmann_json systemd + zlib + ] ++ lib.optionals withBpf [ libbpf elfutils - zlib ]; # BPF A call to built-in function '__stack_chk_fail' is not supported. - hardeningDisable = [ "stackprotector" ]; + hardeningDisable = [ + "stackprotector" + "zerocallusedregs" + ]; cmakeFlags = [ - "-DUSE_EXTERNAL_JSON=ON" - "-DUSE_EXTERNAL_SPDLOG=ON" - "-DUSE_EXTERNAL_FMTLIB=ON" - "-DUSE_BPF_PROC_IMPL=ON" - "-DBPF_BUILD_LIBBPF=OFF" - "-DENABLE_SYSTEMD=ON" - "-DENABLE_REGEX_SUPPORT=ON" - "-DVERSION=${version}" + (lib.mapAttrsToList lib.cmakeBool { + "USE_EXTERNAL_JSON" = true; + "USE_EXTERNAL_SPDLOG" = true; + "USE_EXTERNAL_FMTLIB" = true; + "USE_BPF_PROC_IMPL" = withBpf; + "BPF_BUILD_LIBBPF" = false; + "ENABLE_SYSTEMD" = true; + "ENABLE_REGEX_SUPPORT" = true; + }) + (lib.cmakeFeature "VERSION" finalAttrs.version) ]; postInstall = '' @@ -85,4 +94,4 @@ clangStdenv.mkDerivation rec { ]; mainProgram = "ananicy-cpp"; }; -} +}) |