1{
2 stdenv,
3 lib,
4 jekyll,
5 cmake,
6 fetchFromGitHub,
7 gtest,
8}:
9
10stdenv.mkDerivation rec {
11 pname = "jsonnet";
12 version = "0.21.0";
13 outputs = [
14 "out"
15 "doc"
16 ];
17
18 src = fetchFromGitHub {
19 rev = "v${version}";
20 owner = "google";
21 repo = "jsonnet";
22 sha256 = "sha256-QHp0DOu/pqcgN7di219cHzfFb7fWtdGGE6J1ZXgbOGQ=";
23 };
24
25 nativeBuildInputs = [
26 jekyll
27 cmake
28 ];
29 buildInputs = [ gtest ];
30
31 cmakeFlags = [
32 "-DUSE_SYSTEM_GTEST=ON"
33 "-DBUILD_STATIC_LIBS=${if stdenv.hostPlatform.isStatic then "ON" else "OFF"}"
34 ]
35 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
36 "-DBUILD_SHARED_BINARIES=${if stdenv.hostPlatform.isStatic then "OFF" else "ON"}"
37 ];
38
39 enableParallelBuilding = true;
40
41 # Upstream writes documentation in html, not in markdown/rst, so no
42 # other output formats, sorry.
43 postBuild = ''
44 jekyll build --source ../doc --destination ./html
45 '';
46
47 postInstall = ''
48 mkdir -p $out/share/doc/jsonnet
49 cp -r ./html $out/share/doc/jsonnet
50 '';
51
52 meta = {
53 description = "Purely-functional configuration language that helps you define JSON data";
54 maintainers = with lib.maintainers; [
55 benley
56 ];
57 license = lib.licenses.asl20;
58 homepage = "https://github.com/google/jsonnet";
59 platforms = lib.platforms.unix;
60 };
61}