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