Files
Cédric Prezelin 2f08d9917d rtk: fix build with Rust 1.97
Rust 1.97 exposes dead code while compiling rtk 0.43.0's test target, and upstream promotes warnings to errors.

Cap lints until a release includes the develop-branch fix from https://github.com/rtk-ai/rtk/commit/73b8cb3069297374a3de58552b9fe4aa2cda3a41.
2026-07-24 17:17:24 +02:00

70 lines
1.6 KiB
Nix

{
lib,
rustPlatform,
fetchFromGitHub,
makeWrapper,
pkg-config,
sqlite,
gitMinimal,
writableTmpDirAsHomeHook,
versionCheckHook,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "rtk";
version = "0.43.0";
__structuredAttrs = true;
src = fetchFromGitHub {
owner = "rtk-ai";
repo = "rtk";
tag = "v${finalAttrs.version}";
hash = "sha256-n5bkPPsrdM4fE5ltocTjlq+JwRgp39yib6S79fci4m4=";
};
cargoHash = "sha256-XKUKdhxfnwUCOx9slqx4oUFa09HcosPLVh5Xkh87oSk=";
# Rust 1.97's dead_code_pub_in_binary analysis exposes dead code in test builds.
# Fixed upstream on develop after 0.43.0:
# https://github.com/rtk-ai/rtk/commit/73b8cb3069297374a3de58552b9fe4aa2cda3a41
# TODO: Remove RUSTFLAGS when updating rtk to the next release.
env.RUSTFLAGS = "--cap-lints warn";
nativeBuildInputs = [
makeWrapper
pkg-config
];
buildInputs = [
sqlite
];
postInstall = ''
wrapProgram $out/bin/rtk \
--prefix PATH : ${
lib.makeBinPath [
gitMinimal
]
}
'';
nativeCheckInputs = [
gitMinimal
writableTmpDirAsHomeHook
];
nativeInstallCheckInputs = [
versionCheckHook
];
doInstallCheck = true;
meta = {
description = "CLI proxy that reduces LLM token consumption by 60-90% on common dev commands";
homepage = "https://github.com/rtk-ai/rtk";
changelog = "https://github.com/rtk-ai/rtk/blob/${finalAttrs.src.tag}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ GaetanLepage ];
mainProgram = "rtk";
};
})