typst-bot: 6be5470f -> c9d4b164

This commit is contained in:
Primrose 2025-07-30 12:44:58 +02:00
parent cc8f3066af
commit c174f936cb
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -1,16 +1,11 @@
{ {
lib, lib,
rustPlatform, rustPlatform,
runCommand,
fetchFromGitHub, fetchFromGitHub,
}: let }: let
rev = "6be5470fcb19e857f76ede9a7f0c96cac63e3abc"; rev = "c9d4b164ff5dc2567bb0de3876460e51da62ba94";
in in
rustPlatform.buildRustPackage (finalAttrs: let rustPlatform.buildRustPackage (finalAttrs: {
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;
@ -18,18 +13,17 @@ in
owner = "mattfbacon"; owner = "mattfbacon";
repo = "typst-bot"; repo = "typst-bot";
inherit rev; inherit rev;
hash = "sha256-G3tcyFiHeVH77YT2NeIXS/U1GvqGJBw8o26AlBUc4ok="; hash = "sha256-tB+zrE5p7zOloOgoP2fmFsajd4IBf94ET1v/0W3aNcM=";
}; };
preBuild = '' preBuild = ''
# Don't use the upstream way of embedding the git rev # Don't use the upstream way of embedding the git rev
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
substituteInPlace crates/worker/src/sandbox.rs --replace-fail 'read_dir("fonts")' 'read_dir("${fontDrv}")'
# 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("${placeholder "out"}/bin/worker")' substituteInPlace crates/bot/src/worker.rs --replace-fail \
'"./worker"' \
'"${placeholder "out"}/bin/worker"'
''; '';
cargoBuildFlags = ["--workspace"]; cargoBuildFlags = ["--workspace"];
@ -37,7 +31,7 @@ in
cargoLock = { cargoLock = {
lockFile = "${finalAttrs.src}/Cargo.lock"; lockFile = "${finalAttrs.src}/Cargo.lock";
outputHashes = { outputHashes = {
"poise-0.6.1" = "sha256-AZtF5P7E5xzHJcNdc1k61P2Rr8vIt+oun9vFYSr0nSc="; "poise-0.6.1" = "sha256-iXyp9sR/vzPsexGPdRjfuKyFcGqvDdqiBAXnuw/HFo8=";
}; };
}; };
}) })