packages: refactor cargo rust packages

This commit is contained in:
Primrose 2025-07-28 12:11:02 +02:00
parent 318ca4fbc6
commit b9639eb49c
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
4 changed files with 42 additions and 34 deletions

View file

@ -3,8 +3,12 @@
fetchFromGitHub,
fetchpatch,
}:
rustPlatform.buildRustPackage {
name = "typst-mutilate";
rustPlatform.buildRustPackage (finalAttrs: let
cargoToml = fromTOML (builtins.readFile (finalAttrs.src + "/Cargo.toml"));
cargoLock = finalAttrs.src + "/Cargo.lock";
in {
pname = "typst-mutilate";
version = cargoToml.package.version;
src = fetchFromGitHub {
owner = "frozolotl";
@ -13,7 +17,7 @@ rustPlatform.buildRustPackage {
hash = "sha256-r4fkFv1np8xhff3m8yev1rU1vfKRz8zQMIKIc+fOjew=";
};
cargoHash = "sha256-QEOXPf/k+fCMNQxKGsW3FDsgH5XXUKob0XOef3DiB0s=";
cargoLock.lockFile = cargoLock;
patches = [
(fetchpatch {
@ -22,4 +26,4 @@ rustPlatform.buildRustPackage {
hash = "sha256-+6DMQo4cjVASgkX4gcYrEkwQ/uxttV/61fDnXBqbNcg=";
})
];
}
})