1{
2 callPackage,
3 lib,
4 rustPlatform,
5 fetchFromGitHub,
6 pkg-config,
7 openssl,
8 testers,
9}:
10
11rustPlatform.buildRustPackage rec {
12 pname = "lychee";
13 version = "0.19.1";
14
15 src = fetchFromGitHub {
16 owner = "lycheeverse";
17 repo = "lychee";
18 rev = "lychee-v${version}";
19 hash = "sha256-OyJ3K6ZLAUCvvrsuhN3FMh31sAYe1bWPmOSibdBL9+4=";
20 };
21
22 cargoHash = "sha256-hruCTnj6rZak5JbZjtdSpajg+Y+GVTZqvS0Z09S7cfE=";
23
24 nativeBuildInputs = [ pkg-config ];
25
26 buildInputs = [ openssl ];
27
28 cargoTestFlags = [
29 # don't run doctests since they tend to use the network
30 "--lib"
31 "--bins"
32 "--tests"
33 ];
34
35 checkFlags = [
36 # Network errors for all of these tests
37 # "error reading DNS system conf: No such file or directory (os error 2)" } }
38 "--skip=archive::wayback::tests::wayback_suggestion_real_unknown"
39 "--skip=archive::wayback::tests::wayback_api_no_breaking_changes"
40 "--skip=cli::test_dont_dump_data_uris_by_default"
41 "--skip=cli::test_dump_data_uris_in_verbose_mode"
42 "--skip=cli::test_exclude_example_domains"
43 "--skip=cli::test_local_dir"
44 "--skip=cli::test_local_file"
45 "--skip=client::tests"
46 "--skip=collector::tests"
47 "--skip=src/lib.rs"
48 # Color error for those tests as we are not in a tty
49 "--skip=formatters::response::color::tests::test_format_response_with_error_status"
50 "--skip=formatters::response::color::tests::test_format_response_with_ok_status"
51 ];
52
53 passthru.tests = {
54 # NOTE: These assume that testers.lycheeLinkCheck uses this exact derivation.
55 # Which is true most of the time, but not necessarily after overriding.
56 ok = callPackage ./tests/ok.nix { };
57 fail = callPackage ./tests/fail.nix { };
58 fail-emptyDirectory = callPackage ./tests/fail-emptyDirectory.nix { };
59 network = testers.runNixOSTest ./tests/network.nix;
60 };
61
62 meta = {
63 description = "Fast, async, stream-based link checker written in Rust";
64 homepage = "https://github.com/lycheeverse/lychee";
65 downloadPage = "https://github.com/lycheeverse/lychee/releases/tag/lychee-v${version}";
66 license = with lib.licenses; [
67 asl20
68 mit
69 ];
70 maintainers = with lib.maintainers; [
71 totoroot
72 tuxinaut
73 ];
74 mainProgram = "lychee";
75 };
76}