diff options
author | Pol Dellaiera <pol.dellaiera@protonmail.com> | 2023-11-19 19:16:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-19 19:16:36 +0100 |
commit | 2cc73b2b7cabeb0639e55e39b24b572adb8298ed (patch) | |
tree | 89bb3ec87564edeb135b526e49d5a3872744fd02 /pkgs | |
parent | 5a7118da750f58e5c701f541859fbe58c27b9bef (diff) | |
parent | 6a2fc4017b445e3bbbee18ec935a46d3c35f03e4 (diff) |
Merge pull request #268293 from drupol/bump/typst-preview
Bump Typst tools and VSCode extension
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/applications/editors/vscode/extensions/default.nix | 49 | ||||
-rw-r--r-- | pkgs/by-name/ty/typst-preview/Cargo.lock (renamed from pkgs/tools/typesetting/typst-preview/Cargo.lock) | 2 | ||||
-rw-r--r-- | pkgs/by-name/ty/typst-preview/package.json (renamed from pkgs/tools/typesetting/typst-preview/package.json) | 0 | ||||
-rw-r--r-- | pkgs/by-name/ty/typst-preview/package.nix | 94 | ||||
-rw-r--r-- | pkgs/tools/typesetting/typst-preview/default.nix | 73 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 |
6 files changed, 116 insertions, 104 deletions
diff --git a/pkgs/applications/editors/vscode/extensions/default.nix b/pkgs/applications/editors/vscode/extensions/default.nix index 365b26642b3ec..b583e8135609c 100644 --- a/pkgs/applications/editors/vscode/extensions/default.nix +++ b/pkgs/applications/editors/vscode/extensions/default.nix @@ -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="; + }; - nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ]; + buildInputs = [ + typst-preview + ]; - buildInputs = lib.optionals stdenv.isLinux [ stdenv.cc.cc.lib ]; + nativeBuildInputs = [ jq moreutils ]; + + 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 = { diff --git a/pkgs/tools/typesetting/typst-preview/Cargo.lock b/pkgs/by-name/ty/typst-preview/Cargo.lock index 3d988b5918652..81618b1902ead 100644 --- a/pkgs/tools/typesetting/typst-preview/Cargo.lock +++ b/pkgs/by-name/ty/typst-preview/Cargo.lock @@ -3390,7 +3390,7 @@ dependencies = [ [[package]] name = "typst-preview" -version = "0.9.0" +version = "0.9.1" dependencies = [ "anyhow", "chrono", diff --git a/pkgs/tools/typesetting/typst-preview/package.json b/pkgs/by-name/ty/typst-preview/package.json index f68c8a6b1a23f..f68c8a6b1a23f 100644 --- a/pkgs/tools/typesetting/typst-preview/package.json +++ b/pkgs/by-name/ty/typst-preview/package.json diff --git a/pkgs/by-name/ty/typst-preview/package.nix b/pkgs/by-name/ty/typst-preview/package.nix new file mode 100644 index 0000000000000..880e7288ca976 --- /dev/null +++ b/pkgs/by-name/ty/typst-preview/package.nix @@ -0,0 +1,94 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, mkYarnPackage +, fetchYarnDeps +, pkg-config +, libgit2 +, openssl +, zlib +, stdenv +, darwin +}: + +let + # 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 = "typst-preview"; + rev = "v${version}"; + hash = "sha256-VmUcnmTe5Ngcje0SSpOY13HUIfdxBMg8KwvZ1wupCqc="; + }; + + frontendSrc = "${src}/addons/frontend"; + + frontend = mkYarnPackage { + inherit version; + pname = "typst-preview-frontend"; + src = frontendSrc; + packageJSON = ./package.json; + + offlineCache = fetchYarnDeps { + yarnLock = "${frontendSrc}/yarn.lock"; + hash = "sha256-7a7/UOfau84nLIAKj6Tn9rTUmeBJ7rYDFAdr55ZDLgA="; + }; + + buildPhase = '' + runHook preBuild + yarn --offline build + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + cp -R deps/typst-preview-frontend/dist $out + runHook postInstall + ''; + + doDist = false; + }; +in +rustPlatform.buildRustPackage { + pname = "typst-preview"; + inherit version src; + + 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="; + }; + }; + + 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 = { + 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"; + }; +} diff --git a/pkgs/tools/typesetting/typst-preview/default.nix b/pkgs/tools/typesetting/typst-preview/default.nix deleted file mode 100644 index ac3786f5513b7..0000000000000 --- a/pkgs/tools/typesetting/typst-preview/default.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ lib, fetchFromGitHub, rustPlatform, fetchYarnDeps, mkYarnPackage, darwin -, stdenv }: - -let - name = "typst-preview"; - version = "0.9.0"; - src = fetchFromGitHub { - owner = "Enter-tainer"; - repo = name; - rev = "v${version}"; - hash = "sha256-r/zDvfMvfvZqa3Xkzk70tIEyhc5LDwqc2A5MUuK2xC0="; - }; - frontendSrc = "${src}/addons/frontend"; - frontend = mkYarnPackage rec { - inherit version; - pname = "${name}-frontend"; - src = frontendSrc; - packageJSON = ./package.json; - - offlineCache = fetchYarnDeps { - yarnLock = "${frontendSrc}/yarn.lock"; - hash = "sha256-7a7/UOfau84nLIAKj6Tn9rTUmeBJ7rYDFAdr55ZDLgA="; - }; - - buildPhase = '' - runHook preBuild - yarn --offline build - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - cp -R deps/${pname}/dist $out - runHook postInstall - ''; - doDist = false; - }; - -in rustPlatform.buildRustPackage rec { - - pname = name; - 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="; - }; - }; - - 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 ]; - mainProgram = "typst-preview"; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 501fab51e9e6c..251e745f800c1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { }; |