feat: better way to pass git rev

This commit is contained in:
Youwen Wu 2024-12-31 19:51:09 -08:00
parent da7939855b
commit c937821c11
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
5 changed files with 7 additions and 15 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
result* result*
*.pdf

1
.rev
View file

@ -1 +0,0 @@
UNSTABLE_DO_NOT_USE

BIN
cv.pdf

Binary file not shown.

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";
}
]; ];
typstOpts = {
input = ''GIT_REV=${if (self ? rev) then self.rev else "GIT_UNSTABLE_DONT_USE"}'';
};
}; };
typstPackagesSrc = "${inputs.typst-packages}/packages"; typstPackagesSrc = "${inputs.typst-packages}/packages";
@ -83,14 +83,6 @@
XDG_CACHE_HOME = typstPackagesCache; XDG_CACHE_HOME = typstPackagesCache;
SOURCE_DATE_EPOCH = builtins.toString self.lastModified; SOURCE_DATE_EPOCH = builtins.toString self.lastModified;
preBuild =
if (self ? rev) then
''
echo ${self.rev} >> .rev
''
else
"";
} }
); );

View file

@ -1,6 +1,6 @@
#import "@preview/fontawesome:0.5.0": * #import "@preview/fontawesome:0.5.0": *
#let git_rev = read("./.rev", encoding: "utf8") #let git_rev = sys.inputs.GIT_REV;
#let _cv-line(left, right, ..args) = { #let _cv-line(left, right, ..args) = {
set block(below: 0pt) set block(below: 0pt)
@ -147,7 +147,7 @@
#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] #text(size: 8pt)[Built from revision #git_rev.]
] ]
] ]