2022-09-30 11:47:45 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, pandoc
|
2024-02-29 20:09:43 +00:00
|
|
|
, typst
|
2022-09-30 11:47:45 +00:00
|
|
|
, esbuild
|
|
|
|
, deno
|
|
|
|
, fetchurl
|
2023-10-09 19:29:22 +00:00
|
|
|
, dart-sass
|
2022-09-30 11:47:45 +00:00
|
|
|
, rWrapper
|
|
|
|
, rPackages
|
2023-03-30 22:05:00 +00:00
|
|
|
, extraRPackages ? []
|
2022-09-30 11:47:45 +00:00
|
|
|
, makeWrapper
|
2023-10-09 19:29:22 +00:00
|
|
|
, runCommand
|
2022-09-30 11:47:45 +00:00
|
|
|
, python3
|
2023-10-09 19:29:22 +00:00
|
|
|
, quarto
|
2023-03-30 22:05:00 +00:00
|
|
|
, extraPythonPackages ? ps: with ps; []
|
2023-10-19 13:55:26 +00:00
|
|
|
, sysctl
|
2022-09-30 11:47:45 +00:00
|
|
|
}:
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
stdenv.mkDerivation (final: {
|
2022-09-30 11:47:45 +00:00
|
|
|
pname = "quarto";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "1.4.553";
|
2022-09-30 11:47:45 +00:00
|
|
|
src = fetchurl {
|
2023-10-09 19:29:22 +00:00
|
|
|
url = "https://github.com/quarto-dev/quarto-cli/releases/download/v${final.version}/quarto-${final.version}-linux-amd64.tar.gz";
|
2024-04-21 15:54:59 +00:00
|
|
|
sha256 = "sha256-IrdUGx4b6XRmV6RHODeWukIObwy8XnsxyCKd3rwljJA=";
|
2022-09-30 11:47:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
2022-12-02 08:20:57 +00:00
|
|
|
postPatch = ''
|
|
|
|
# Compat for Deno >=1.26
|
|
|
|
substituteInPlace bin/quarto.js \
|
2024-02-29 20:09:43 +00:00
|
|
|
--replace-fail ']))?.trim();' ']))?.trim().split(" ")[0];'
|
2022-12-02 08:20:57 +00:00
|
|
|
'';
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
preFixup = ''
|
|
|
|
wrapProgram $out/bin/quarto \
|
2024-02-29 20:09:43 +00:00
|
|
|
--prefix QUARTO_DENO : ${lib.getExe deno} \
|
|
|
|
--prefix QUARTO_PANDOC : ${lib.getExe pandoc} \
|
|
|
|
--prefix QUARTO_ESBUILD : ${lib.getExe esbuild} \
|
|
|
|
--prefix QUARTO_DART_SASS : ${lib.getExe dart-sass} \
|
|
|
|
--prefix QUARTO_TYPST : ${lib.getExe typst} \
|
2023-07-15 17:15:38 +00:00
|
|
|
${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"}
|
2022-09-30 11:47:45 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out/bin $out/share
|
|
|
|
|
|
|
|
rm -r bin/tools
|
|
|
|
|
|
|
|
mv bin/* $out/bin
|
|
|
|
mv share/* $out/share
|
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
runHook postInstall
|
2022-09-30 11:47:45 +00:00
|
|
|
'';
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
passthru.tests = {
|
2023-10-19 13:55:26 +00:00
|
|
|
quarto-check = runCommand "quarto-check" {
|
|
|
|
nativeBuildInputs = lib.optionals stdenv.isDarwin [ sysctl ];
|
|
|
|
} ''
|
2023-10-09 19:29:22 +00:00
|
|
|
export HOME="$(mktemp -d)"
|
|
|
|
${quarto}/bin/quarto check
|
|
|
|
touch $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Open-source scientific and technical publishing system built on Pandoc";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "quarto";
|
2022-09-30 11:47:45 +00:00
|
|
|
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;
|
2023-07-15 17:15:38 +00:00
|
|
|
maintainers = with maintainers; [ minijackson mrtarantoga ];
|
2023-10-19 13:55:26 +00:00
|
|
|
platforms = platforms.all;
|
2022-09-30 11:47:45 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode binaryBytecode ];
|
|
|
|
};
|
2023-10-09 19:29:22 +00:00
|
|
|
})
|