2024-05-13 21:24:10 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, nix, rustPlatform, CoreServices
|
|
|
|
, installShellFiles }:
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "mdbook";
|
|
|
|
version = "0.4.37";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rust-lang";
|
|
|
|
repo = "mdBook";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
sha256 = "sha256-A8ZSqIG+rGKwggs9ogvbMIi9gClFKe8gS6D5W426ebc=";
|
|
|
|
};
|
|
|
|
|
|
|
|
cargoHash = "sha256-8GQM4pHiFbyoRkOx3SXuIV118ndzL+O+eA+Gd2jbsdI=";
|
|
|
|
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ CoreServices ];
|
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
postInstall =
|
|
|
|
lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
|
|
installShellCompletion --cmd mdbook \
|
|
|
|
--bash <($out/bin/mdbook completions bash) \
|
|
|
|
--fish <($out/bin/mdbook completions fish) \
|
|
|
|
--zsh <($out/bin/mdbook completions zsh )
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = { tests = { inherit nix; }; };
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Create books from MarkDown";
|
|
|
|
mainProgram = "mdbook";
|
|
|
|
homepage = "https://github.com/rust-lang/mdBook";
|
2024-05-13 21:24:10 +00:00
|
|
|
changelog =
|
|
|
|
"https://github.com/rust-lang/mdBook/blob/v${version}/CHANGELOG.md";
|
2024-05-02 00:46:19 +00:00
|
|
|
license = [ licenses.mpl20 ];
|
|
|
|
maintainers = with maintainers; [ havvy Frostman matthiasbeyer ];
|
|
|
|
};
|
|
|
|
}
|