biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / tools / text / termbook / default.nix
blob7172de5e41d7f21d6720eb1b5cf367cdd1c69e72
1 { lib
2 , rustPlatform
3 , fetchFromGitHub
4 , installShellFiles
5 , pkg-config
6 , oniguruma
7 , stdenv
8 , darwin
9 }:
11 rustPlatform.buildRustPackage rec {
12   pname = "termbook-cli";
13   version = "1.4.6";
15   src = fetchFromGitHub {
16     owner = "Byron";
17     repo = "termbook";
18     rev = "v${version}";
19     sha256 = "Bo3DI0cMXIfP7ZVr8MAW/Tmv+4mEJBIQyLvRfVBDG8c=";
20   };
22   cargoLock = {
23     lockFile = ./Cargo.lock;
24   };
26   nativeBuildInputs = [
27     installShellFiles
28     pkg-config
29   ];
31   buildInputs = [
32     oniguruma
33   ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
34     darwin.apple_sdk.frameworks.Security
35   ];
37   env = {
38     RUSTONIG_SYSTEM_LIBONIG = true;
39   };
41   # update dependencies to fix build failure caused by unaligned packed structs
42   postPatch = ''
43     ln -sf ${./Cargo.lock} Cargo.lock
44   '';
46   postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
47     installShellCompletion --cmd termbook \
48       --bash <($out/bin/termbook completions bash) \
49       --fish <($out/bin/termbook completions fish) \
50       --zsh <($out/bin/termbook completions zsh)
51   '';
53   meta = with lib; {
54     description = "Runner for `mdbooks` to keep your documentation tested";
55     mainProgram = "termbook";
56     homepage = "https://github.com/Byron/termbook/";
57     changelog = "https://github.com/Byron/termbook/blob/${src.rev}/CHANGELOG.md";
58     license = licenses.asl20;
59     maintainers = with maintainers; [ phaer ];
60   };