2021-07-14 22:03:04 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-10-19 23:25:03 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, rustPlatform
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-10-19 23:25:03 +00:00
|
|
|
, asciidoctor
|
|
|
|
, openssl
|
|
|
|
, Security
|
|
|
|
, ansi2html
|
|
|
|
, installShellFiles
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "mdcat";
|
2021-07-14 22:03:04 +00:00
|
|
|
version = "0.23.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "lunaryorn";
|
|
|
|
repo = pname;
|
|
|
|
rev = "mdcat-${version}";
|
2021-07-14 22:03:04 +00:00
|
|
|
hash = "sha256-bGXuYGQyrXa9gUEQfB7BF9K04z88r1UoM8R5gpL2nRM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config asciidoctor installShellFiles ];
|
2021-07-14 22:03:04 +00:00
|
|
|
buildInputs = [ openssl ]
|
|
|
|
++ lib.optional stdenv.isDarwin Security;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
cargoSha256 = "sha256-hmv4LNk7NEYjT/5XXUpMd+xGS19KHOW+HIgsiFEWeig=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
checkInputs = [ ansi2html ];
|
2020-10-19 23:25:03 +00:00
|
|
|
# Skip tests that use the network and that include files.
|
|
|
|
checkFlags = [
|
|
|
|
"--skip magic::tests::detect_mimetype_of_larger_than_magic_param_bytes_max_length"
|
|
|
|
"--skip magic::tests::detect_mimetype_of_magic_param_bytes_max_length"
|
|
|
|
"--skip magic::tests::detect_mimetype_of_png_image"
|
|
|
|
"--skip magic::tests::detect_mimetype_of_svg_image"
|
2021-07-14 22:03:04 +00:00
|
|
|
"--skip resources::tests::read_url_with_http_url_fails_when_size_limit_is_exceeded"
|
2020-10-19 23:25:03 +00:00
|
|
|
"--skip resources::tests::read_url_with_http_url_fails_when_status_404"
|
|
|
|
"--skip resources::tests::read_url_with_http_url_returns_content_when_status_200"
|
|
|
|
"--skip iterm2_tests_render_md_samples_images_md"
|
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
installManPage $releaseDir/build/mdcat-*/out/mdcat.1
|
|
|
|
installShellCompletion --bash $releaseDir/build/mdcat-*/out/completions/mdcat.bash
|
|
|
|
installShellCompletion --fish $releaseDir/build/mdcat-*/out/completions/mdcat.fish
|
|
|
|
installShellCompletion --zsh $releaseDir/build/mdcat-*/out/completions/_mdcat
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "cat for markdown";
|
|
|
|
homepage = "https://github.com/lunaryorn/mdcat";
|
|
|
|
license = with licenses; [ asl20 ];
|
2021-07-14 22:03:04 +00:00
|
|
|
maintainers = with maintainers; [ davidtwco SuperSandro2000 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|