base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12 (#356361)
[NixPkgs.git] / pkgs / tools / text / mdcat / default.nix
blob39d3738dab53cc8616d9e0d00bbd4c34bb0ace8d
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , rustPlatform
5 , pkg-config
6 , asciidoctor
7 , openssl
8 , Security
9 , SystemConfiguration
10 , ansi2html
11 , installShellFiles
14 rustPlatform.buildRustPackage rec {
15   pname = "mdcat";
16   version = "2.6.1";
18   src = fetchFromGitHub {
19     owner = "swsnr";
20     repo = "mdcat";
21     rev = "mdcat-${version}";
22     hash = "sha256-iZenHdlYoHyX4CC2/qeNWBYxoeE35kx6xnYWfxcRZYg=";
23   };
25   nativeBuildInputs = [ pkg-config asciidoctor installShellFiles ];
26   buildInputs = [ openssl ]
27     ++ lib.optionals stdenv.hostPlatform.isDarwin [ Security SystemConfiguration ];
29   cargoHash = "sha256-NnsChyW7lwnlv2MWSJTlFIBVVpvUsYIiilDnmfIBE+8=";
31   nativeCheckInputs = [ ansi2html ];
32   # Skip tests that use the network and that include files.
33   checkFlags = [
34     "--skip magic::tests::detect_mimetype_of_larger_than_magic_param_bytes_max_length"
35     "--skip magic::tests::detect_mimetype_of_magic_param_bytes_max_length"
36     "--skip magic::tests::detect_mimetype_of_png_image"
37     "--skip magic::tests::detect_mimetype_of_svg_image"
38     "--skip resources::tests::read_url_with_http_url_fails_when_size_limit_is_exceeded"
39     "--skip resources::tests::read_url_with_http_url_fails_when_status_404"
40     "--skip resources::tests::read_url_with_http_url_returns_content_when_status_200"
41     "--skip iterm2_tests_render_md_samples_images_md"
42   ];
44   postInstall = ''
45     installManPage $releaseDir/build/mdcat-*/out/mdcat.1
46     ln -sr $out/bin/{mdcat,mdless}
47   '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
48     for bin in mdcat mdless; do
49       installShellCompletion --cmd $bin \
50         --bash <($out/bin/$bin --completions bash) \
51         --fish <($out/bin/$bin --completions fish) \
52         --zsh <($out/bin/$bin --completions zsh)
53     done
54   '';
56   meta = with lib; {
57     description = "cat for markdown";
58     homepage = "https://github.com/swsnr/mdcat";
59     changelog = "https://github.com/swsnr/mdcat/releases/tag/mdcat-${version}";
60     license = with licenses; [ mpl20 ];
61     maintainers = with maintainers; [ SuperSandro2000 ];
62   };