Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 clangStdenv, 4 fetchFromGitLab, 5 fetchpatch, 6 cmake, 7 pkg-config, 8 spdlog, 9 nlohmann_json, 10 systemd, 11 libbpf, 12 elfutils, 13 bpftools, 14 pcre2, 15 zlib, 16 withBpf ? true, 17}: 18 19clangStdenv.mkDerivation (finalAttrs: { 20 pname = "ananicy-cpp"; 21 version = "1.1.1"; 22 23 src = fetchFromGitLab { 24 owner = "ananicy-cpp"; 25 repo = "ananicy-cpp"; 26 tag = "v${finalAttrs.version}"; 27 fetchSubmodules = true; 28 hash = "sha256-oPinSc00+Z6SxjfTh7DttcXSjsLv1X0NI+O37C8M8GY="; 29 }; 30 31 patches = [ 32 ./match-wrappers.patch 33 34 # FIXME: remove these when updating to next stable release 35 (fetchpatch { 36 name = "allow-regex-pattern-matching.patch"; 37 url = "https://gitlab.com/ananicy-cpp/ananicy-cpp/-/commit/6ea2dccceec39b6c4913f617dad81d859aa20f24.patch"; 38 hash = "sha256-C+7x/VpVwewXEPwibi7GxGfjuhDkhcjTyGbZHlYL2Bs="; 39 }) 40 (fetchpatch { 41 name = "use-a-reliable-path-for-mounts-file.patch"; 42 url = "https://gitlab.com/ananicy-cpp/ananicy-cpp/-/commit/de6f11978db98bfd13a1e87dcdab61dbe6496710.patch"; 43 hash = "sha256-9bJlFCClddlAEknfqp7Gcij7NX6tqohE2wqoalLoN5I="; 44 }) 45 # https://gitlab.com/ananicy-cpp/ananicy-cpp/-/merge_requests/30 46 (fetchpatch { 47 name = "fix-build-with-clang-19.patch"; 48 url = "https://gitlab.com/ananicy-cpp/ananicy-cpp/-/commit/b2589a9b1faa2ecf54aeede40ea781c33bfb09a8.patch"; 49 hash = "sha256-nfyCdhvnWj446z5aPFCXGi79Xgja8W0Eopl6I30fOBM="; 50 }) 51 ]; 52 53 strictDeps = true; 54 55 nativeBuildInputs = [ 56 cmake 57 pkg-config 58 ] 59 ++ lib.optionals withBpf [ 60 bpftools 61 ]; 62 63 buildInputs = [ 64 pcre2 65 spdlog 66 nlohmann_json 67 systemd 68 zlib 69 ] 70 ++ lib.optionals withBpf [ 71 libbpf 72 elfutils 73 ]; 74 75 # BPF A call to built-in function '__stack_chk_fail' is not supported. 76 hardeningDisable = [ 77 "stackprotector" 78 "zerocallusedregs" 79 ]; 80 81 cmakeFlags = [ 82 (lib.mapAttrsToList lib.cmakeBool { 83 "USE_EXTERNAL_JSON" = true; 84 "USE_EXTERNAL_SPDLOG" = true; 85 "USE_EXTERNAL_FMTLIB" = true; 86 "USE_BPF_PROC_IMPL" = withBpf; 87 "BPF_BUILD_LIBBPF" = false; 88 "ENABLE_SYSTEMD" = true; 89 "ENABLE_REGEX_SUPPORT" = true; 90 }) 91 (lib.cmakeFeature "VERSION" finalAttrs.version) 92 ]; 93 94 postInstall = '' 95 rm -rf "$out"/include 96 rm -rf "$out"/lib/cmake 97 ''; 98 99 meta = { 100 homepage = "https://gitlab.com/ananicy-cpp/ananicy-cpp"; 101 description = "Rewrite of ananicy in c++ for lower cpu and memory usage"; 102 license = lib.licenses.gpl3Plus; 103 platforms = lib.platforms.linux; 104 maintainers = with lib.maintainers; [ 105 artturin 106 johnrtitor 107 diniamo 108 ]; 109 mainProgram = "ananicy-cpp"; 110 }; 111})