mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
typst-bot: refactor
This commit is contained in:
parent
cc2c89bbd7
commit
7a27565b0d
1 changed files with 10 additions and 6 deletions
|
|
@ -1,11 +1,16 @@
|
||||||
{
|
{
|
||||||
rustPlatform,
|
|
||||||
fetchFromGitHub,
|
|
||||||
lib,
|
lib,
|
||||||
|
rustPlatform,
|
||||||
|
runCommand,
|
||||||
|
fetchFromGitHub,
|
||||||
}: let
|
}: let
|
||||||
rev = "6be5470fcb19e857f76ede9a7f0c96cac63e3abc";
|
rev = "6be5470fcb19e857f76ede9a7f0c96cac63e3abc";
|
||||||
in
|
in
|
||||||
rustPlatform.buildRustPackage (finalAttrs: {
|
rustPlatform.buildRustPackage (finalAttrs: let
|
||||||
|
fontDrv = runCommand "typst-bot-font" {} ''
|
||||||
|
cp -r ${finalAttrs.src}/fonts $out
|
||||||
|
'';
|
||||||
|
in {
|
||||||
pname = "typst-bot";
|
pname = "typst-bot";
|
||||||
version = lib.substring 0 8 rev;
|
version = lib.substring 0 8 rev;
|
||||||
|
|
||||||
|
|
@ -21,11 +26,10 @@ in
|
||||||
echo 'fn main() { println!("cargo:rustc-env=BUILD_SHA=${rev}"); }' > crates/bot/build.rs
|
echo 'fn main() { println!("cargo:rustc-env=BUILD_SHA=${rev}"); }' > crates/bot/build.rs
|
||||||
|
|
||||||
# Patch the fonts with src
|
# Patch the fonts with src
|
||||||
# FIXME: is this the right way to patch
|
substituteInPlace crates/worker/src/sandbox.rs --replace-fail 'read_dir("fonts")' 'read_dir("${fontDrv}")'
|
||||||
substituteInPlace crates/worker/src/sandbox.rs --replace-fail 'read_dir("fonts")' 'read_dir("${finalAttrs.src}/fonts")'
|
|
||||||
|
|
||||||
# Patch the command calling the worker by name.
|
# Patch the command calling the worker by name.
|
||||||
substituteInPlace crates/bot/src/worker.rs --replace-fail 'Command::new("./worker")' 'Command::new("worker")'
|
substituteInPlace crates/bot/src/worker.rs --replace-fail 'Command::new("./worker")' 'Command::new("${placeholder "out"}/bin/worker")'
|
||||||
'';
|
'';
|
||||||
|
|
||||||
cargoBuildFlags = ["--workspace"];
|
cargoBuildFlags = ["--workspace"];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue