Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 46 lines 1.2 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 cmake, 6}: 7 8stdenv.mkDerivation rec { 9 pname = "cmark"; 10 version = "0.31.1"; 11 12 src = fetchFromGitHub { 13 owner = "commonmark"; 14 repo = "cmark"; 15 rev = version; 16 sha256 = "sha256-+JLw7zCjjozjq1RhRQGFqHj/MTUTq3t7A0V3T2U2PQk="; 17 }; 18 19 nativeBuildInputs = [ cmake ]; 20 21 cmakeFlags = 22 # Link the executable with the shared library on system with shared libraries. 23 lib.optional (!stdenv.hostPlatform.isStatic) "-DCMARK_STATIC=OFF" 24 # Do not attempt to build .so library on static platform. 25 ++ lib.optional stdenv.hostPlatform.isStatic "-DCMARK_SHARED=OFF"; 26 27 doCheck = true; 28 29 preCheck = 30 let 31 lib_path = if stdenv.hostPlatform.isDarwin then "DYLD_FALLBACK_LIBRARY_PATH" else "LD_LIBRARY_PATH"; 32 in 33 '' 34 export ${lib_path}=$(readlink -f ./src) 35 ''; 36 37 meta = { 38 description = "CommonMark parsing and rendering library and program in C"; 39 mainProgram = "cmark"; 40 homepage = "https://github.com/commonmark/cmark"; 41 changelog = "https://github.com/commonmark/cmark/raw/${version}/changelog.txt"; 42 maintainers = [ lib.maintainers.michelk ]; 43 platforms = lib.platforms.all; 44 license = lib.licenses.bsd2; 45 }; 46}