{ lib, rustPlatform, fetchFromGitHub, }: rustPlatform.buildRustPackage (finalAttrs: { pname = "typst-bot"; version = lib.substring 0 8 finalAttrs.src.rev; src = fetchFromGitHub { owner = "mattfbacon"; repo = "typst-bot"; rev = "a4f2e0ea6046a1f9d551c1543d42696107d18a78"; hash = "sha256-bLB9W/2nHPL/T2TxTJLBBC5JSQczklZ34n6AJAR/3gI="; }; preBuild = '' # Don't use the upstream way of embedding the git rev echo 'fn main() { println!("cargo:rustc-env=BUILD_SHA=${finalAttrs.src.rev}"); }' > crates/bot/build.rs # Patch the command calling the worker by name. substituteInPlace crates/bot/src/worker.rs --replace-fail \ '"./worker"' \ '"${placeholder "out"}/bin/worker"' ''; cargoBuildFlags = [ "--workspace" ]; cargoLock = { lockFile = "${finalAttrs.src}/Cargo.lock"; outputHashes = { "poise-0.6.1" = "sha256-/UrFlHWDsCDaqWd+XchmH0PzauxIWuYaJp9ZZh3W+50="; "typst-dev-assets-0.14.2" = "sha256-mRkQXg1YG0qqcTVtgpQpvKw54RM9FBo1EgM2WJFbQAI="; }; }; })