1{ stdenv
2, lib
3, pandoc
4, esbuild
5, deno
6, fetchurl
7, dart-sass
8, rWrapper
9, rPackages
10, extraRPackages ? []
11, makeWrapper
12, runCommand
13, python3
14, quarto
15, extraPythonPackages ? ps: with ps; []
16, sysctl
17}:
18
19stdenv.mkDerivation (final: {
20 pname = "quarto";
21 version = "1.3.450";
22 src = fetchurl {
23 url = "https://github.com/quarto-dev/quarto-cli/releases/download/v${final.version}/quarto-${final.version}-linux-amd64.tar.gz";
24 sha256 = "sha256-bcj7SzEGfQxsw9P8WkcLrKurPupzwpgIGtxoE3KVwAU=";
25 };
26
27 nativeBuildInputs = [
28 makeWrapper
29 ];
30
31 patches = [
32 ./fix-deno-path.patch
33 ];
34
35 postPatch = ''
36 # Compat for Deno >=1.26
37 substituteInPlace bin/quarto.js \
38 --replace 'Deno.setRaw(stdin.rid, ' 'Deno.stdin.setRaw(' \
39 --replace 'Deno.setRaw(Deno.stdin.rid, ' 'Deno.stdin.setRaw('
40 '';
41
42 dontStrip = true;
43
44 preFixup = ''
45 wrapProgram $out/bin/quarto \
46 --prefix PATH : ${lib.makeBinPath [ deno ]} \
47 --prefix QUARTO_PANDOC : ${pandoc}/bin/pandoc \
48 --prefix QUARTO_ESBUILD : ${esbuild}/bin/esbuild \
49 --prefix QUARTO_DART_SASS : ${dart-sass}/bin/dart-sass \
50 ${lib.optionalString (rWrapper != null) "--prefix QUARTO_R : ${rWrapper.override { packages = [ rPackages.rmarkdown ] ++ extraRPackages; }}/bin/R"} \
51 ${lib.optionalString (python3 != null) "--prefix QUARTO_PYTHON : ${python3.withPackages (ps: with ps; [ jupyter ipython ] ++ (extraPythonPackages ps))}/bin/python3"}
52 '';
53
54 installPhase = ''
55 runHook preInstall
56
57 mkdir -p $out/bin $out/share
58
59 rm -r bin/tools
60
61 mv bin/* $out/bin
62 mv share/* $out/share
63
64 runHook postInstall
65 '';
66
67 passthru.tests = {
68 quarto-check = runCommand "quarto-check" {
69 nativeBuildInputs = lib.optionals stdenv.isDarwin [ sysctl ];
70 } ''
71 export HOME="$(mktemp -d)"
72 ${quarto}/bin/quarto check
73 touch $out
74 '';
75 };
76
77 meta = with lib; {
78 description = "Open-source scientific and technical publishing system built on Pandoc";
79 longDescription = ''
80 Quarto is an open-source scientific and technical publishing system built on Pandoc.
81 Quarto documents are authored using markdown, an easy to write plain text format.
82 '';
83 homepage = "https://quarto.org/";
84 changelog = "https://github.com/quarto-dev/quarto-cli/releases/tag/v${version}";
85 license = licenses.gpl2Plus;
86 maintainers = with maintainers; [ minijackson mrtarantoga ];
87 platforms = platforms.all;
88 sourceProvenance = with sourceTypes; [ binaryNativeCode binaryBytecode ];
89 };
90})