2023-11-12 15:54:43 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, nix, rustPlatform, CoreServices, installShellFiles }:
|
2018-02-23 11:22:30 +01:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
2019-08-31 13:41:23 +02:00
|
|
|
pname = "mdbook";
|
2024-02-07 08:04:10 +01:00
|
|
|
version = "0.4.37";
|
2018-02-23 11:22:30 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-08-08 09:03:03 +02:00
|
|
|
owner = "rust-lang";
|
2018-02-23 11:22:30 +01:00
|
|
|
repo = "mdBook";
|
2022-12-15 18:29:45 +01:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-02-07 08:04:10 +01:00
|
|
|
sha256 = "sha256-A8ZSqIG+rGKwggs9ogvbMIi9gClFKe8gS6D5W426ebc=";
|
2018-02-23 11:22:30 +01:00
|
|
|
};
|
|
|
|
|
2024-02-07 08:04:10 +01:00
|
|
|
cargoHash = "sha256-8GQM4pHiFbyoRkOx3SXuIV118ndzL+O+eA+Gd2jbsdI=";
|
2018-02-23 11:22:30 +01:00
|
|
|
|
2023-11-12 15:54:43 +01:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
2021-01-15 10:19:50 +01:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ CoreServices ];
|
2018-02-23 11:22:30 +01:00
|
|
|
|
2023-11-12 15:54:43 +01: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 )
|
|
|
|
'';
|
|
|
|
|
2022-07-16 02:45:46 +02:00
|
|
|
passthru = {
|
|
|
|
tests = {
|
|
|
|
inherit nix;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2018-02-23 11:22:30 +01:00
|
|
|
description = "Create books from MarkDown";
|
2024-03-19 03:14:51 +01:00
|
|
|
mainProgram = "mdbook";
|
2021-08-08 09:03:03 +02:00
|
|
|
homepage = "https://github.com/rust-lang/mdBook";
|
2022-12-15 18:29:45 +01:00
|
|
|
changelog = "https://github.com/rust-lang/mdBook/blob/v${version}/CHANGELOG.md";
|
2019-08-04 22:55:28 +02:00
|
|
|
license = [ licenses.mpl20 ];
|
2023-08-12 00:41:21 +02:00
|
|
|
maintainers = with maintainers; [ havvy Frostman matthiasbeyer ];
|
2018-02-23 11:22:30 +01:00
|
|
|
};
|
|
|
|
}
|