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