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;
})

View file

@ -8,6 +8,7 @@
}:
rustPlatform.buildRustPackage (finalAttrs: let
cargoToml = fromTOML (builtins.readFile (finalAttrs.src + "/Cargo.toml"));
cargoLock = finalAttrs.src + "/Cargo.lock";
in {
pname = "emoji-picker";
version = cargoToml.package.version;
@ -19,7 +20,7 @@ in {
hash = "sha256-ETZRqyQ5lzYA6NGOXLnxfpwb4qMMC1l7s5XA8H5s9Jw=";
};
cargoHash = "sha256-rJKFRWaqulnan2jtt0erj5cypSBe0Z5PiNcOXd3HCZs=";
cargoLock.lockFile = cargoLock;
nativeBuildInputs = [
python3

View file

@ -6,34 +6,35 @@
libiconv,
darwin,
zlib,
}: let
rev = "v13.0.0-alpha.8";
in
rustPlatform.buildRustPackage {
pname = "tokei";
version = rev;
}:
rustPlatform.buildRustPackage (finalAttrs: let
cargoToml = fromTOML (builtins.readFile (finalAttrs.src + "/Cargo.toml"));
cargoLock = finalAttrs.src + "/Cargo.lock";
in {
pname = "tokei";
version = cargoToml.package.version;
src = fetchFromGitHub {
owner = "XAMPPRocky";
repo = "tokei";
inherit rev;
hash = "sha256-jCI9VM3y76RI65E5UGuAPuPkDRTMyi+ydx64JWHcGfE=";
};
src = fetchFromGitHub {
owner = "XAMPPRocky";
repo = "tokei";
rev = "v13.0.0-alpha.8";
hash = "sha256-jCI9VM3y76RI65E5UGuAPuPkDRTMyi+ydx64JWHcGfE=";
};
cargoHash = "sha256-LzlyrKaRjUo6JnVLQnHidtI4OWa+GrhAc4D8RkL+nmQ=";
cargoLock.lockFile = cargoLock;
patches = [
./skel.patch
./why3.patch
];
patches = [
./skel.patch
./why3.patch
];
buildInputs = lib.optionals stdenv.isDarwin [
libiconv
darwin.Security
];
buildInputs = lib.optionals stdenv.isDarwin [
libiconv
darwin.Security
];
checkInputs = lib.optionals stdenv.isDarwin [zlib];
checkInputs = lib.optionals stdenv.isDarwin [zlib];
# enable all output formats
buildFeatures = ["all"];
}
# enable all output formats
buildFeatures = ["all"];
})

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=";
})
];
}
})