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

@ -1,11 +1,13 @@
{
lib,
rustPlatform,
fetchFromGitea,
}:
rustPlatform.buildRustPackage (finalAttrs: {
rustPlatform.buildRustPackage (finalAttrs: let
cargoToml = fromTOML (builtins.readFile (finalAttrs.src + "/Cargo.toml"));
cargoLock = finalAttrs.src + "/Cargo.lock";
in {
pname = "audio-lint";
version = lib.substring 0 8 finalAttrs.src.rev;
version = cargoToml.package.version;
src = fetchFromGitea {
domain = "git.confusedcompiler.org";
@ -15,5 +17,5 @@ rustPlatform.buildRustPackage (finalAttrs: {
hash = "sha256-h1SnWAh3FPL5GweOXVXXtp+swZApgecYaWjy7rM/J+w=";
};
cargoHash = "sha256-daaNDuxS/mbADCk4X+ZOrzEeu2vrQj1gDJ9y9bMihSk=";
cargoLock.lockFile = cargoLock;
})