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

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