fix: get time and git revision from nix typst environment

This commit is contained in:
Youwen Wu 2024-12-31 19:44:35 -08:00
parent 8a64ae158c
commit da7939855b
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
5 changed files with 33 additions and 8 deletions

1
.rev Normal file
View file

@ -0,0 +1 @@
UNSTABLE_DO_NOT_USE

BIN
cv.pdf

Binary file not shown.

4
cv.typ
View file

@ -76,10 +76,6 @@
Nix and NixOS, Docker and NixOS based service deployment and system administration. Nix and NixOS, Docker and NixOS based service deployment and system administration.
] ]
#cv-line[Other][
Git and Mercurial Version Control.
]
= Papers = Papers
== Preprints == Preprints

View file

@ -54,11 +54,11 @@
dest = "icons"; dest = "icons";
src = "${inputs.font-awesome}/svgs/regular"; src = "${inputs.font-awesome}/svgs/regular";
} }
{
src = ./.rev;
dest = ".rev";
}
]; ];
XDG_CACHE_HOME = typstPackagesCache;
SOURCE_DATE_EPOCH = builtins.toString self.lastModified;
}; };
typstPackagesSrc = "${inputs.typst-packages}/packages"; typstPackagesSrc = "${inputs.typst-packages}/packages";
@ -79,6 +79,18 @@
commonArgs commonArgs
// { // {
inherit src; inherit src;
XDG_CACHE_HOME = typstPackagesCache;
SOURCE_DATE_EPOCH = builtins.toString self.lastModified;
preBuild =
if (self ? rev) then
''
echo ${self.rev} >> .rev
''
else
"";
} }
); );
@ -88,6 +100,18 @@
commonArgs commonArgs
// { // {
inherit src; inherit src;
XDG_CACHE_HOME = typstPackagesCache;
SOURCE_DATE_EPOCH = builtins.toString self.lastModified;
preBuild =
if (self ? rev) then
''
echo ${self.rev} >> .rev
''
else
"";
} }
); );

View file

@ -1,5 +1,7 @@
#import "@preview/fontawesome:0.5.0": * #import "@preview/fontawesome:0.5.0": *
#let git_rev = read("./.rev", encoding: "utf8")
#let _cv-line(left, right, ..args) = { #let _cv-line(left, right, ..args) = {
set block(below: 0pt) set block(below: 0pt)
table( table(
@ -144,6 +146,8 @@
#v(1fr, weak: false) #v(1fr, weak: false)
#name\ #name\
#datetime.today().display("[month repr:long] [day], [year]") #datetime.today().display("[month repr:long] [day], [year]")
#text(size: 8pt)[Built from revision #git_rev]
] ]
] ]