depot/third_party/nixpkgs/pkgs/by-name/md/mdbook/package.nix
Default email f34ce41345 Project import generated by Copybara.
GitOrigin-RevId: b73c2221a46c13557b1b3be9c2070cc42cf01eb3
2024-07-27 08:49:29 +02:00

56 lines
1.3 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
nix,
rustPlatform,
darwin,
CoreServices ? darwin.apple_sdk.frameworks.CoreServices,
installShellFiles,
}:
let
version = "0.4.40";
in
rustPlatform.buildRustPackage {
inherit version;
pname = "mdbook";
src = fetchFromGitHub {
owner = "rust-lang";
repo = "mdBook";
rev = "refs/tags/v${version}";
sha256 = "sha256-GGQK2Mf3EK1rwBMzQkAzWAaK6Fh0Qqqf8dtDjZPxOMA=";
};
cargoHash = "sha256-jriSQHn+Y+EWtwDJeMTAuCCHR7fEtWsErAxbG9a4pts=";
nativeBuildInputs = [ installShellFiles ];
buildInputs = lib.optionals stdenv.isDarwin [ CoreServices ];
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;
};
};
meta = {
description = "Create books from MarkDown";
mainProgram = "mdbook";
homepage = "https://github.com/rust-lang/mdBook";
changelog = "https://github.com/rust-lang/mdBook/blob/v${version}/CHANGELOG.md";
license = [ lib.licenses.mpl20 ];
maintainers = with lib.maintainers; [
havvy
Frostman
matthiasbeyer
];
};
}