Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv, lib, fetchgit, cmake, pkg-config, json_c, with_lua ? false, lua5_1, with_ustream_ssl ? false, ustream-ssl }: 2 3stdenv.mkDerivation { 4 pname = "libubox"; 5 version = "unstable-2023-01-03${lib.optionalString with_ustream_ssl "-${ustream-ssl.ssl_implementation.pname}"}"; 6 7 src = fetchgit { 8 url = "https://git.openwrt.org/project/libubox.git"; 9 rev = "eac92a4d5d82eb31e712157e7eb425af728b2c43"; 10 sha256 = "0w6mmwmd3ljhkqfk0qswq28dp63k30s3brlgf8lyi7vj7mrhvn3c"; 11 }; 12 13 cmakeFlags = [ "-DBUILD_EXAMPLES=OFF" (if with_lua then "-DLUAPATH=${placeholder "out"}/lib/lua" else "-DBUILD_LUA=OFF") ]; 14 15 nativeBuildInputs = [ cmake pkg-config ]; 16 buildInputs = [ json_c ] ++ lib.optional with_lua lua5_1 ++ lib.optional with_ustream_ssl ustream-ssl; 17 18 postInstall = lib.optionalString with_ustream_ssl '' 19 for fin in $(find ${ustream-ssl} -type f); do 20 fout="''${fin/"${ustream-ssl}"/"''${out}"}" 21 ln -s "$fin" "$fout" 22 done 23 ''; 24 25 meta = with lib; { 26 description = "C utility functions for OpenWrt"; 27 homepage = "https://git.openwrt.org/?p=project/libubox.git;a=summary"; 28 license = licenses.isc; 29 maintainers = with maintainers; [ fpletz ]; 30 mainProgram = "jshn"; 31 platforms = platforms.all; 32 }; 33}