Skip to content

Commit fbd7470

Browse files
committed
➕ Add font-awesome
1 parent 01fe973 commit fbd7470

File tree

19 files changed

+1160
-124
lines changed

19 files changed

+1160
-124
lines changed

.github/workflows/main.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
19+
- uses: typst-community/setup-typst@v3
1920
- uses: actions/checkout@v4
2021
with:
2122
repository: chengda/popular-fonts
@@ -24,15 +25,24 @@ jobs:
2425
with:
2526
repository: StellarCN/scp_zh
2627
path: fonts/scp_zh
27-
- uses: typst-community/setup-typst@v3
28+
- uses: actions/checkout@v4
29+
with:
30+
repository: siaimes/pytorch
31+
path: fonts/pytorch
32+
- uses: actions/checkout@v4
33+
with:
34+
repository: Kangzhengwei/androidFront
35+
path: fonts/androidFront
2836
- run: |
37+
sudo apt-get -y update
38+
sudo apt-get -y install fonts-font-awesome
2939
mkdir -p ~/.local/share
3040
mv fonts ~/.local/share
31-
typst compile main.typ
41+
typst compile template/main.typ
3242
- uses: actions/upload-artifact@v4
3343
with:
3444
path: ./*.pdf
3545
- uses: softprops/action-gh-release@v2
3646
if: github.ref_type == 'tag'
3747
with:
38-
files: main.pdf
48+
files: template/main.pdf

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ repos:
7272
- id: markdownlint-cli2
7373
additional_dependencies:
7474
- markdown-it-texmath
75+
- repo: https://github.com/Enter-tainer/typstyle
76+
rev: v0.12.14
77+
hooks:
78+
- id: typstyle
7579
- repo: https://github.com/NixOS/nixfmt
7680
rev: 8d4bd690c247004d90d8554f0b746b1231fe2436
7781
hooks:

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# USTC proposal template
1+
# USTC proposal
22

33
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/ustc-ivclab/ustc-proposal/main.svg)](https://results.pre-commit.ci/latest/github/ustc-ivclab/ustc-proposal/main)
44
[![github/workflow](https://github.com/ustc-ivclab/ustc-proposal/actions/workflows/main.yml/badge.svg)](https://github.com/ustc-ivclab/ustc-proposal/actions)
@@ -27,13 +27,33 @@
2727
[![github/repo-size](https://shields.io/github/repo-size/ustc-ivclab/ustc-proposal)](https://github.com/ustc-ivclab/ustc-proposal)
2828
[![github/v](https://shields.io/github/v/release/ustc-ivclab/ustc-proposal)](https://github.com/ustc-ivclab/ustc-proposal)
2929

30+
![screenshot](template/images/main-1.png)
31+
3032
## Dependencies
3133

3234
- [华文字体](https://github.com/chengda/popular-fonts)
3335
- [中易字体](https://github.com/StellarCN/scp_zh/tree/master/fonts)
36+
- [方正字体](https://github.com/Kangzhengwei/androidFront)
37+
- [Times New Roman](https://github.com/siaimes/pytorch/tree/main/fonts)
38+
- [font-awesome](https://github.com/FortAwesome/Font-Awesome)
3439

3540
## Build
3641

42+
Download all fonts, then
43+
3744
```sh
3845
typst compile main.typ
3946
```
47+
48+
Or use Nix:
49+
50+
```sh
51+
nix run '.#build'
52+
```
53+
54+
## Related Projects
55+
56+
### USTC proposal template
57+
58+
- [docx](https://cicpi.ustc.edu.cn/indico/conferenceDisplay.py?confId=971)
59+
- [LaTeX](https://github.com/cgdsss/thesis_proposal_ustc)

flake.lock

Lines changed: 167 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
{
2+
description = "ustc-proposal";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
7+
typix = {
8+
url = "github:loqusion/typix";
9+
inputs.nixpkgs.follows = "nixpkgs";
10+
};
11+
12+
flake-utils.url = "github:numtide/flake-utils";
13+
14+
typst-packages = {
15+
url = "github:typst/packages";
16+
flake = false;
17+
};
18+
19+
fonts-popular-fonts = {
20+
url = "github:chengda/popular-fonts";
21+
flake = false;
22+
};
23+
24+
fonts-scp_zh = {
25+
url = "github:StellarCN/scp_zh";
26+
flake = false;
27+
};
28+
29+
fonts-pytorch = {
30+
url = "github:siaimes/pytorch";
31+
flake = false;
32+
};
33+
34+
fonts-androidFront = {
35+
url = "github:Kangzhengwei/androidFront";
36+
flake = false;
37+
};
38+
};
39+
40+
outputs =
41+
inputs@{
42+
nixpkgs,
43+
typix,
44+
flake-utils,
45+
...
46+
}:
47+
flake-utils.lib.eachDefaultSystem (
48+
system:
49+
let
50+
pkgs = nixpkgs.legacyPackages.${system};
51+
typixLib = typix.lib.${system};
52+
53+
src = typixLib.cleanTypstSource ./.;
54+
commonArgs = {
55+
typstSource = "template/main.typ";
56+
57+
fontPaths = [
58+
"${pkgs.font-awesome}/share/fonts/opentype"
59+
"${inputs.fonts-popular-fonts}"
60+
"${inputs.fonts-scp_zh}/fonts"
61+
"${inputs.fonts-pytorch}/fonts"
62+
"${inputs.fonts-androidFront}"
63+
];
64+
65+
virtualPaths = [
66+
# Add paths that must be locally accessible to typst here
67+
# {
68+
# dest = "icons";
69+
# src = "${inputs.font-awesome}/svgs/regular";
70+
# }
71+
];
72+
};
73+
typstPackagesSrc = pkgs.symlinkJoin {
74+
name = "typst-packages-src";
75+
paths = [
76+
"${inputs.typst-packages}/packages"
77+
# More Typst packages can be added here
78+
];
79+
};
80+
typstPackagesCache = pkgs.stdenvNoCC.mkDerivation {
81+
name = "typst-packages-cache";
82+
src = typstPackagesSrc;
83+
dontBuild = true;
84+
installPhase = ''
85+
mkdir -p "$out/typst/packages"
86+
cp -LR --reflink=auto --no-preserve=mode -t "$out/typst/packages" "$src"/*
87+
'';
88+
};
89+
90+
# Compile a Typst project, *without* copying the result
91+
# to the current directory
92+
build-drv = typixLib.buildTypstProject (
93+
commonArgs
94+
// {
95+
inherit src;
96+
XDG_CACHE_HOME = typstPackagesCache;
97+
}
98+
);
99+
100+
# Compile a Typst project, and then copy the result
101+
# to the current directory
102+
build-script = typixLib.buildTypstProjectLocal (
103+
commonArgs
104+
// {
105+
inherit src;
106+
XDG_CACHE_HOME = typstPackagesCache;
107+
}
108+
);
109+
110+
# Watch a project and recompile on changes
111+
watch-script = typixLib.watchTypstProject commonArgs;
112+
in
113+
{
114+
checks = {
115+
inherit build-drv build-script watch-script;
116+
};
117+
118+
packages.default = build-drv;
119+
120+
apps = rec {
121+
default = watch;
122+
build = flake-utils.lib.mkApp {
123+
drv = build-script;
124+
};
125+
watch = flake-utils.lib.mkApp {
126+
drv = watch-script;
127+
};
128+
};
129+
130+
devShells.default = typixLib.devShell {
131+
inherit (commonArgs) fontPaths virtualPaths;
132+
packages = [
133+
# WARNING: Don't run `typst-build` directly, instead use `nix run .#build`
134+
# See https://github.com/loqusion/typix/issues/2
135+
# build-script
136+
watch-script
137+
# More packages can be added here, like typstfmt
138+
# pkgs.typstfmt
139+
];
140+
};
141+
}
142+
);
143+
}

0 commit comments

Comments
 (0)