|
8 | 8 | xz,
|
9 | 9 | nix-update-script,
|
10 | 10 | versionCheckHook,
|
| 11 | + callPackage, |
11 | 12 | }:
|
| 13 | +let |
| 14 | + typst = rustPlatform.buildRustPackage rec { |
| 15 | + pname = "typst"; |
| 16 | + version = "0.12.0"; |
12 | 17 |
|
13 |
| -rustPlatform.buildRustPackage rec { |
14 |
| - pname = "typst"; |
15 |
| - version = "0.12.0"; |
| 18 | + src = fetchFromGitHub { |
| 19 | + owner = "typst"; |
| 20 | + repo = "typst"; |
| 21 | + tag = "v${version}"; |
| 22 | + hash = "sha256-OfTMJ7ylVOJjL295W3Flj2upTiUQXmfkyDFSE1v8+a4="; |
| 23 | + }; |
16 | 24 |
|
17 |
| - src = fetchFromGitHub { |
18 |
| - owner = "typst"; |
19 |
| - repo = "typst"; |
20 |
| - tag = "v${version}"; |
21 |
| - hash = "sha256-OfTMJ7ylVOJjL295W3Flj2upTiUQXmfkyDFSE1v8+a4="; |
22 |
| - }; |
| 25 | + cargoDeps = rustPlatform.fetchCargoVendor { |
| 26 | + inherit pname version src; |
| 27 | + hash = "sha256-dphMJ1KkZARSntvyEayAtlYw8lL39K7Iw0X4n8nz3z8="; |
| 28 | + }; |
23 | 29 |
|
24 |
| - cargoDeps = rustPlatform.fetchCargoVendor { |
25 |
| - inherit pname version src; |
26 |
| - hash = "sha256-dphMJ1KkZARSntvyEayAtlYw8lL39K7Iw0X4n8nz3z8="; |
27 |
| - }; |
| 30 | + nativeBuildInputs = [ |
| 31 | + installShellFiles |
| 32 | + pkg-config |
| 33 | + ]; |
28 | 34 |
|
29 |
| - nativeBuildInputs = [ |
30 |
| - installShellFiles |
31 |
| - pkg-config |
32 |
| - ]; |
| 35 | + buildInputs = [ |
| 36 | + openssl |
| 37 | + xz |
| 38 | + ]; |
33 | 39 |
|
34 |
| - buildInputs = [ |
35 |
| - openssl |
36 |
| - xz |
37 |
| - ]; |
| 40 | + env = { |
| 41 | + GEN_ARTIFACTS = "artifacts"; |
| 42 | + OPENSSL_NO_VENDOR = true; |
| 43 | + }; |
38 | 44 |
|
39 |
| - env = { |
40 |
| - GEN_ARTIFACTS = "artifacts"; |
41 |
| - OPENSSL_NO_VENDOR = true; |
42 |
| - }; |
| 45 | + postPatch = '' |
| 46 | + # Fix for "Found argument '--test-threads' which wasn't expected, or isn't valid in this context" |
| 47 | + substituteInPlace tests/src/tests.rs --replace-fail 'ARGS.num_threads' 'ARGS.test_threads' |
| 48 | + substituteInPlace tests/src/args.rs --replace-fail 'num_threads' 'test_threads' |
| 49 | + ''; |
43 | 50 |
|
44 |
| - postPatch = '' |
45 |
| - # Fix for "Found argument '--test-threads' which wasn't expected, or isn't valid in this context" |
46 |
| - substituteInPlace tests/src/tests.rs --replace-fail 'ARGS.num_threads' 'ARGS.test_threads' |
47 |
| - substituteInPlace tests/src/args.rs --replace-fail 'num_threads' 'test_threads' |
48 |
| - ''; |
| 51 | + postInstall = '' |
| 52 | + installManPage crates/typst-cli/artifacts/*.1 |
| 53 | + installShellCompletion \ |
| 54 | + crates/typst-cli/artifacts/typst.{bash,fish} \ |
| 55 | + --zsh crates/typst-cli/artifacts/_typst |
| 56 | + ''; |
49 | 57 |
|
50 |
| - postInstall = '' |
51 |
| - installManPage crates/typst-cli/artifacts/*.1 |
52 |
| - installShellCompletion \ |
53 |
| - crates/typst-cli/artifacts/typst.{bash,fish} \ |
54 |
| - --zsh crates/typst-cli/artifacts/_typst |
55 |
| - ''; |
| 58 | + cargoTestFlags = [ "--workspace" ]; |
56 | 59 |
|
57 |
| - cargoTestFlags = [ "--workspace" ]; |
| 60 | + nativeInstallCheckInputs = [ versionCheckHook ]; |
| 61 | + versionCheckProgramArg = [ "--version" ]; |
| 62 | + doInstallCheck = true; |
58 | 63 |
|
59 |
| - nativeInstallCheckInputs = [ |
60 |
| - versionCheckHook |
61 |
| - ]; |
62 |
| - versionCheckProgramArg = [ "--version" ]; |
63 |
| - doInstallCheck = true; |
| 64 | + passthru.updateScript = nix-update-script { }; |
64 | 65 |
|
65 |
| - passthru.updateScript = nix-update-script { }; |
66 |
| - |
67 |
| - meta = { |
68 |
| - changelog = "https://github.com/typst/typst/releases/tag/v${version}"; |
69 |
| - description = "New markup-based typesetting system that is powerful and easy to learn"; |
70 |
| - homepage = "https://github.com/typst/typst"; |
71 |
| - license = lib.licenses.asl20; |
72 |
| - mainProgram = "typst"; |
73 |
| - maintainers = with lib.maintainers; [ |
74 |
| - drupol |
75 |
| - figsoda |
76 |
| - kanashimia |
77 |
| - ]; |
| 66 | + meta = { |
| 67 | + changelog = "https://github.com/typst/typst/releases/tag/v${version}"; |
| 68 | + description = "New markup-based typesetting system that is powerful and easy to learn"; |
| 69 | + homepage = "https://github.com/typst/typst"; |
| 70 | + license = lib.licenses.asl20; |
| 71 | + mainProgram = "typst"; |
| 72 | + maintainers = with lib.maintainers; [ |
| 73 | + drupol |
| 74 | + figsoda |
| 75 | + kanashimia |
| 76 | + ]; |
| 77 | + }; |
78 | 78 | };
|
79 |
| -} |
| 79 | + |
| 80 | + internal = callPackage ./with-packages.nix { }; |
| 81 | + |
| 82 | + typstFinal = self: self // { withPackages = internal.typstPackagesFor self; }; |
| 83 | +in |
| 84 | +typstFinal typst |
0 commit comments