1 { lib, stdenv, fetchFromGitHub, cmake }:
3 stdenv.mkDerivation rec {
7 src = fetchFromGitHub {
11 sha256 = "sha256-/7TzaZYP8lndkfRPgCpBbazUBytVLXxqWHYktIsGox0=";
14 nativeBuildInputs = [ cmake ];
17 # Link the executable with the shared library on system with shared libraries.
18 lib.optional (!stdenv.hostPlatform.isStatic) "-DCMARK_STATIC=OFF"
19 # Do not attempt to build .so library on static platform.
20 ++ lib.optional stdenv.hostPlatform.isStatic "-DCMARK_SHARED=OFF";
25 lib_path = if stdenv.isDarwin then "DYLD_FALLBACK_LIBRARY_PATH" else "LD_LIBRARY_PATH";
27 export ${lib_path}=$(readlink -f ./src)
31 description = "CommonMark parsing and rendering library and program in C";
32 homepage = "https://github.com/commonmark/cmark";
33 changelog = "https://github.com/commonmark/cmark/raw/${version}/changelog.txt";
34 maintainers = [ maintainers.michelk ];
35 platforms = platforms.all;
36 license = licenses.bsd2;