1{ stdenv, lib, jekyll, fetchFromGitHub }:
2
3stdenv.mkDerivation rec {
4 pname = "jsonnet";
5 version = "0.20.0";
6 outputs = ["out" "doc"];
7
8 src = fetchFromGitHub {
9 rev = "v${version}";
10 owner = "google";
11 repo = "jsonnet";
12 sha256 = "sha256-FtVJE9alEl56Uik+nCpJMV5DMVVmRCnE1xMAiWdK39Y=";
13 };
14
15 nativeBuildInputs = [ jekyll ];
16
17 enableParallelBuilding = true;
18
19 makeFlags = [
20 "jsonnet"
21 "jsonnetfmt"
22 "libjsonnet.so"
23 ];
24
25 # Upstream writes documentation in html, not in markdown/rst, so no
26 # other output formats, sorry.
27 preBuild = ''
28 jekyll build --source ./doc --destination ./html
29 '';
30
31 installPhase = ''
32 mkdir -p $out/bin $out/lib $out/include $out/share/doc/jsonnet
33 cp jsonnet $out/bin/
34 cp jsonnetfmt $out/bin/
35 cp libjsonnet*.so $out/lib/
36 cp -a include/*.h $out/include/
37 cp -r ./html $out/share/doc/jsonnet
38 '';
39
40 meta = {
41 description = "Purely-functional configuration language that helps you define JSON data";
42 maintainers = with lib.maintainers; [ benley copumpkin ];
43 license = lib.licenses.asl20;
44 homepage = "https://github.com/google/jsonnet";
45 platforms = lib.platforms.unix;
46 };
47}