nixpkgs/pkgs/tools/text/termbook/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
1.3 KiB
Nix
Raw Normal View History

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
'';
2023-05-14 21:32:19 +00:00
postInstall = ''
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 = "A runner for `mdbooks` to keep your documentation tested";
homepage = "https://github.com/Byron/termbook/";
changelog = "https://github.com/Byron/termbook/blob/${src.rev}/CHANGELOG.md";
license = licenses.asl20;
maintainers = with maintainers; [ phaer ];
};
}