2021-07-14 22:03:04 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2022-10-21 18:38:19 +00:00
|
|
|
, fetchFromGitHub
|
2020-10-19 23:25:03 +00:00
|
|
|
, rustPlatform
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-10-19 23:25:03 +00:00
|
|
|
, asciidoctor
|
|
|
|
, openssl
|
|
|
|
, Security
|
2023-10-19 13:55:26 +00:00
|
|
|
, SystemConfiguration
|
2020-10-19 23:25:03 +00:00
|
|
|
, ansi2html
|
|
|
|
, installShellFiles
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "mdcat";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "2.1.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
src = fetchFromGitHub {
|
2023-04-29 16:46:19 +00:00
|
|
|
owner = "swsnr";
|
2022-02-20 05:27:41 +00:00
|
|
|
repo = "mdcat";
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = "mdcat-${version}";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-qdNORp9THxHWR95uVcYtCy59OQqdop1012thZN5i64w=";
|
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 ]
|
2023-10-19 13:55:26 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ Security SystemConfiguration ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
cargoHash = "sha256-/avxRvT35LxCBWkTYJDCtdd95VC67epZIPCMv994uBo=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ 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
|
2023-02-22 10:55:15 +00:00
|
|
|
ln -sr $out/bin/{mdcat,mdless}
|
|
|
|
|
|
|
|
for bin in mdcat mdless; do
|
|
|
|
installShellCompletion \
|
|
|
|
--bash $releaseDir/build/mdcat-*/out/completions/$bin.bash \
|
|
|
|
--fish $releaseDir/build/mdcat-*/out/completions/$bin.fish \
|
|
|
|
--zsh $releaseDir/build/mdcat-*/out/completions/_$bin
|
|
|
|
done
|
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";
|
2023-04-29 16:46:19 +00:00
|
|
|
homepage = "https://github.com/swsnr/mdcat";
|
2024-01-25 14:12:00 +00:00
|
|
|
changelog = "https://github.com/swsnr/mdcat/releases/tag/mdcat-${version}";
|
2022-02-20 05:27:41 +00:00
|
|
|
license = with licenses; [ mpl20 ];
|
2022-06-16 17:23:12 +00:00
|
|
|
maintainers = with maintainers; [ SuperSandro2000 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|