blob: ac3786f5513b7af82c166b6a3b386ccf8f2f2dc9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
{ 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";
};
}
|