Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 stdenv, 3 lib, 4 pandoc, 5 typst, 6 esbuild, 7 deno, 8 fetchurl, 9 dart-sass, 10 rWrapper, 11 rPackages, 12 extraRPackages ? [ ], 13 makeWrapper, 14 runCommand, 15 python3, 16 quarto, 17 extraPythonPackages ? ps: [ ], 18 sysctl, 19 which, 20}: 21 22let 23 rWithPackages = rWrapper.override { 24 packages = [ 25 rPackages.rmarkdown 26 ] 27 ++ extraRPackages; 28 }; 29 30 pythonWithPackages = python3.withPackages ( 31 ps: 32 with ps; 33 [ 34 jupyter 35 ipython 36 ] 37 ++ (extraPythonPackages ps) 38 ); 39in 40stdenv.mkDerivation (final: { 41 pname = "quarto"; 42 version = "1.7.32"; 43 44 src = fetchurl { 45 url = "https://github.com/quarto-dev/quarto-cli/releases/download/v${final.version}/quarto-${final.version}-linux-amd64.tar.gz"; 46 hash = "sha256-JiUF49JkWcZOZu/v1LkkDrdV6iDdb+h21qpkx6exPSc="; 47 }; 48 49 patches = [ 50 ./deno2.patch 51 ]; 52 53 nativeBuildInputs = [ 54 makeWrapper 55 which 56 ]; 57 58 dontStrip = true; 59 60 preFixup = '' 61 wrapProgram $out/bin/quarto \ 62 --set-default QUARTO_DENO ${lib.getExe deno} \ 63 --set-default QUARTO_PANDOC ${lib.getExe pandoc} \ 64 --set-default QUARTO_ESBUILD ${lib.getExe esbuild} \ 65 --set-default QUARTO_DART_SASS ${lib.getExe dart-sass} \ 66 --set-default QUARTO_TYPST ${lib.getExe typst} \ 67 ${lib.optionalString (rWrapper != null) "--set-default QUARTO_R ${rWithPackages}/bin/R"} \ 68 ${lib.optionalString ( 69 python3 != null 70 ) "--set-default QUARTO_PYTHON ${pythonWithPackages}/bin/python3"} 71 ''; 72 73 installPhase = '' 74 runHook preInstall 75 76 mkdir -p $out/bin $out/share 77 78 rm -r bin/tools 79 80 mv bin/* $out/bin 81 mv share/* $out/share 82 83 runHook postInstall 84 ''; 85 86 passthru.tests = { 87 quarto-check = 88 runCommand "quarto-check" 89 { 90 nativeBuildInputs = [ which ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ sysctl ]; 91 } 92 '' 93 export HOME="$(mktemp -d)" 94 ${quarto}/bin/quarto check 95 touch $out 96 ''; 97 }; 98 99 meta = with lib; { 100 description = "Open-source scientific and technical publishing system built on Pandoc"; 101 mainProgram = "quarto"; 102 longDescription = '' 103 Quarto is an open-source scientific and technical publishing system built on Pandoc. 104 Quarto documents are authored using markdown, an easy to write plain text format. 105 ''; 106 homepage = "https://quarto.org/"; 107 changelog = "https://github.com/quarto-dev/quarto-cli/releases/tag/v${version}"; 108 license = licenses.gpl2Plus; 109 maintainers = with maintainers; [ 110 minijackson 111 mrtarantoga 112 ]; 113 platforms = platforms.all; 114 sourceProvenance = with sourceTypes; [ 115 binaryNativeCode 116 binaryBytecode 117 ]; 118 }; 119})