2023-05-14 21:27:15 +00:00
|
|
|
{ lib
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
2023-05-14 21:32:19 +00:00
|
|
|
, installShellFiles
|
2023-05-14 21:27:15 +00:00
|
|
|
, pkg-config
|
|
|
|
, oniguruma
|
|
|
|
, stdenv
|
|
|
|
, darwin
|
|
|
|
}:
|
2023-04-26 13:00:37 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "termbook-cli";
|
|
|
|
version = "1.4.6";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Byron";
|
|
|
|
repo = "termbook";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "Bo3DI0cMXIfP7ZVr8MAW/Tmv+4mEJBIQyLvRfVBDG8c=";
|
|
|
|
};
|
|
|
|
|
2023-05-14 21:27:15 +00:00
|
|
|
cargoLock = {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2023-05-14 21:32:19 +00:00
|
|
|
installShellFiles
|
2023-05-14 21:27:15 +00:00
|
|
|
pkg-config
|
|
|
|
];
|
2023-04-26 13:00:37 +00:00
|
|
|
|
2023-05-14 21:27:15 +00:00
|
|
|
buildInputs = [
|
|
|
|
oniguruma
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2023-04-26 13:00:37 +00:00
|
|
|
darwin.apple_sdk.frameworks.Security
|
|
|
|
];
|
|
|
|
|
2023-05-14 21:27:15 +00:00
|
|
|
env = {
|
|
|
|
RUSTONIG_SYSTEM_LIBONIG = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
# update dependencies to fix build failure caused by unaligned packed structs
|
|
|
|
postPatch = ''
|
|
|
|
ln -sf ${./Cargo.lock} Cargo.lock
|
|
|
|
'';
|
|
|
|
|
2024-07-10 11:52:28 +00:00
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
2023-05-14 21:32:19 +00:00
|
|
|
installShellCompletion --cmd termbook \
|
|
|
|
--bash <($out/bin/termbook completions bash) \
|
|
|
|
--fish <($out/bin/termbook completions fish) \
|
|
|
|
--zsh <($out/bin/termbook completions zsh)
|
|
|
|
'';
|
|
|
|
|
2023-04-26 13:00:37 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Runner for `mdbooks` to keep your documentation tested";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "termbook";
|
2023-04-26 13:00:37 +00:00
|
|
|
homepage = "https://github.com/Byron/termbook/";
|
|
|
|
changelog = "https://github.com/Byron/termbook/blob/${src.rev}/CHANGELOG.md";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ phaer ];
|
|
|
|
};
|
|
|
|
}
|