blob: 4734394cd7e79a4f6f0289713166dc1ccd4ce493 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
{
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}";
hash = "sha256-GGQK2Mf3EK1rwBMzQkAzWAaK6Fh0Qqqf8dtDjZPxOMA=";
};
cargoHash = "sha256-jriSQHn+Y+EWtwDJeMTAuCCHR7fEtWsErAxbG9a4pts=";
nativeBuildInputs = [ installShellFiles ];
buildInputs = lib.optionals stdenv.hostPlatform.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
];
};
}
|