Unverified Commit 2cc73b2b authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

Merge pull request #268293 from drupol/bump/typst-preview

Bump Typst tools and VSCode extension 
parents 5a7118da 6a2fc401
Loading
Loading
Loading
Loading
+21 −28
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
, millet
, shfmt
, typst-lsp
, typst-preview
, autoPatchelfHook
, zlib
, stdenv
@@ -2297,37 +2298,26 @@ let
        };
      };

      # Keep pkgs/tools/typesetting/typst-preview/default.nix in sync with this
      # extension
      mgt19937.typst-preview = buildVscodeMarketplaceExtension {
        mktplcRef =
        let
          sources = {
            "x86_64-linux" = {
              arch = "linux-x64";
              sha256 = "sha256-O8sFv23tlhJS6N8LRKkHcTJTupZejCLDRdVVCdDlWbA=";
            };
            "x86_64-darwin" = {
              arch = "darwin-x64";
              sha256 = "1npzjch67agswh3nm14dbbsx777daq2rdw1yny10jf3858z2qynr";
            };
            "aarch64-linux" = {
              arch = "linux-arm64";
              sha256 = "1vv1jfgnyjbmshh4w6rf496d9dpdsk3f0049ii4d9vi23igk4xpk";
            };
            "aarch64-darwin" = {
              arch = "darwin-arm64";
              sha256 = "0dfchzqm61kddq20zvp1pcpk1625b9wgj32ymc08piq06pbadk29";
            };
          };
        in
        {
        mktplcRef = {
          name = "typst-preview";
          publisher = "mgt19937";
          version = "0.6.1";
        } // sources.${stdenv.system};
          version = "0.9.1";
          sha256 = "sha256-GHD/i+QOnItGEYG0bl/pVl+a4Dvn7SHhICJ14VfqMjE=";
        };

        buildInputs = [
          typst-preview
        ];

        nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ];
        nativeBuildInputs = [ jq moreutils ];

        buildInputs = lib.optionals stdenv.isLinux [ stdenv.cc.cc.lib ];
        postInstall = ''
          cd "$out/$installPrefix"
          jq '.contributes.configuration.properties."typst-preview.executable".default = "${lib.getExe typst-preview}"' package.json | sponge package.json
        '';

        meta = {
          description = "Typst Preview is an extension for previewing your Typst files in vscode instantly";
@@ -2745,7 +2735,6 @@ let
        };
      };


      nvarner.typst-lsp = buildVscodeMarketplaceExtension {
        mktplcRef = {
          name = "typst-lsp";
@@ -2758,9 +2747,13 @@ let

        nativeBuildInputs = [ jq moreutils ];

        buildInputs = [
          typst-lsp
        ];

        postInstall = ''
          cd "$out/$installPrefix"
          jq '.contributes.configuration.properties."typst-lsp.serverPath".default = "${typst-lsp}/bin/typst-lsp"' package.json | sponge package.json
          jq '.contributes.configuration.properties."typst-lsp.serverPath".default = "${lib.getExe typst-lsp}"' package.json | sponge package.json
        '';

        meta = {
+1 −1
Original line number Diff line number Diff line
@@ -3390,7 +3390,7 @@ dependencies = [

[[package]]
name = "typst-preview"
version = "0.9.0"
version = "0.9.1"
dependencies = [
 "anyhow",
 "chrono",
+94 −0
Original line number Diff line number Diff line
{ lib, fetchFromGitHub, rustPlatform, fetchYarnDeps, mkYarnPackage, darwin
, stdenv }:
{ lib
, rustPlatform
, fetchFromGitHub
, mkYarnPackage
, fetchYarnDeps
, pkg-config
, libgit2
, openssl
, zlib
, stdenv
, darwin
}:

let
  name = "typst-preview";
  version = "0.9.0";
  # Keep the vscode "mgt19937.typst-preview" extension in sync when updating
  # this package at pkgs/applications/editors/vscode/extensions/default.nix
  version = "0.9.1";

  src = fetchFromGitHub {
    owner = "Enter-tainer";
    repo = name;
    repo = "typst-preview";
    rev = "v${version}";
    hash = "sha256-r/zDvfMvfvZqa3Xkzk70tIEyhc5LDwqc2A5MUuK2xC0=";
    hash = "sha256-VmUcnmTe5Ngcje0SSpOY13HUIfdxBMg8KwvZ1wupCqc=";
  };

  frontendSrc = "${src}/addons/frontend";
  frontend = mkYarnPackage rec {

  frontend = mkYarnPackage {
    inherit version;
    pname = "${name}-frontend";
    pname = "typst-preview-frontend";
    src = frontendSrc;
    packageJSON = ./package.json;

@@ -30,44 +44,51 @@ let

    installPhase = ''
      runHook preInstall
      cp -R deps/${pname}/dist $out
      cp -R deps/typst-preview-frontend/dist $out
      runHook postInstall
    '';

    doDist = false;
  };

in rustPlatform.buildRustPackage rec {

  pname = name;
in
rustPlatform.buildRustPackage {
  pname = "typst-preview";
  inherit version src;

  buildInputs = lib.optionals stdenv.isDarwin
    (with darwin.apple_sdk.frameworks; [
      Security
      SystemConfiguration
      CoreServices
    ]);

  cargoLock = {
    lockFile = ./Cargo.lock;
    outputHashes = {
      "hayagriva-0.4.0" = "sha256-377lXL3+TO8U91OopMYEI0NrWWwzy6+O7B65bLhP+X4=";
      "typst-0.9.0" = "sha256-+rnsUSGi3QZlbC4i8racsM4U6+l8oA9YjjUOtQAIWOk=";
      "typst-ts-compiler-0.4.0-rc9" =
        "sha256-NVmbAodDRJBJlGGDRjaEcTHGoCeN4hNjIynIDKqvNbM=";
      "typst-ts-compiler-0.4.0-rc9" = "sha256-NVmbAodDRJBJlGGDRjaEcTHGoCeN4hNjIynIDKqvNbM=";
    };
  };

  nativeBuildInputs = [
    pkg-config
  ];

  buildInputs = [
    libgit2
    openssl
    zlib
  ] ++ lib.optionals stdenv.isDarwin [
    darwin.apple_sdk.frameworks.CoreFoundation
    darwin.apple_sdk.frameworks.CoreServices
    darwin.apple_sdk.frameworks.Security
    darwin.apple_sdk.frameworks.SystemConfiguration
  ];

  prePatch = ''
    mkdir -p addons/vscode/out/frontend
    cp -R ${frontend}/* addons/vscode/out/frontend/
  '';

  meta = with lib; {
    description = "Preview your Typst files in vscode";
    homepage = "https://github.com/Enter-tainer/typse-preview";
    license = licenses.mit;
    maintainers = with maintainers; [ berberman ];
  meta = {
    description = "Typst preview extension for VSCode";
    homepage = "https://github.com/Enter-tainer/typst-preview/";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ berberman ];
    mainProgram = "typst-preview";
  };
}
+0 −2
Original line number Diff line number Diff line
@@ -14238,8 +14238,6 @@ with pkgs;
  typst-live = callPackage ../tools/typesetting/typst-live { };
  typst-preview = callPackage ../tools/typesetting/typst-preview { };
  tz = callPackage ../tools/misc/tz { };
  u9fs = callPackage ../servers/u9fs { };
Loading