Skip to content

Commit 11a1544

Browse files
committed
Working on typst packages
1 parent 92af24b commit 11a1544

File tree

5 files changed

+35
-2
lines changed

5 files changed

+35
-2
lines changed

modules/exporters/typst/default.nix

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
, settingsSchema
99
}:
1010

11+
with { inherit (settings) packages; };
1112
with { inherit (settings.interface) attrs extensions; };
1213

1314
let
@@ -21,8 +22,10 @@ let
2122
echo_and_run ${typst}/bin/typst compile "$1" "$2"
2223
'';
2324

25+
typstToUse = typst.withPackages (ps: (map (x: ps.${x}) packages));
26+
2427
languageServers = lib.optionals settings.lsp.tinymist.enable
25-
[(callPackage ./language_server_tinymist { inherit kernelName; })];
28+
[(callPackage ./language_server_tinymist { inherit kernelName typstToUse; })];
2629

2730
packageOptions = typst.packages;
2831
packageSearch = common.searcher packageOptions;
@@ -35,7 +38,7 @@ in
3538
symlinkJoin {
3639
name = "codedown-exporter-typst";
3740
paths = [
38-
(callPackage ./kernel.nix { inherit attrs extensions; })
41+
(callPackage ./kernel.nix { inherit attrs extensions typstToUse; })
3942
script
4043
]
4144
++ languageServers

modules/exporters/typst/kernel.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{ lib
22
, callPackage
33
, typst
4+
, typstToUse # TODO: should this kernel actually do something?
45

56
, attrs
67
, extensions

modules/exporters/typst/language_server_tinymist/default.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
, tinymist
55

6+
# TODO: how to make the typstToUse (i.e. Typst with some packages) available to tinymist?
7+
, typstToUse
8+
69
, kernelName
710
}:
811

modules/exporters/typst/module.nix

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
with lib;
44

5+
let
6+
subPackage = types.submodule {
7+
options = {
8+
name = mkOption {
9+
description = "Package name";
10+
type = types.str;
11+
};
12+
outputs = mkOption {
13+
example = "Package outputs to include";
14+
type = types.listOf types.str;
15+
};
16+
};
17+
};
18+
19+
in
20+
521
{
622
options = {
723
exporters.typst = {
@@ -13,6 +29,13 @@ with lib;
1329
visible = false;
1430
};
1531

32+
packages = mkOption {
33+
example = "List of packages";
34+
type = types.listOf (types.either types.str subPackage);
35+
default = [];
36+
visible = false;
37+
};
38+
1639
interface.attrs = mkOption {
1740
example = boilerplate.attrsTitle;
1841
description = boilerplate.attrsDescription;

sample_environments/exporters-typst.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ codedown.makeEnvironment {
66
name = "exporters-typst";
77

88
exporters.typst.enable = true;
9+
exporters.typst.packages = [
10+
"aero-check"
11+
];
912
}

0 commit comments

Comments
 (0)