1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 rustPlatform,
6 pkg-config,
7 alsa-lib,
8 openssl,
9 withTTS ? false,
10 speechd-minimal,
11}:
12rustPlatform.buildRustPackage rec {
13 pname = "blightmud";
14 version = "5.3.1";
15
16 src = fetchFromGitHub {
17 owner = pname;
18 repo = pname;
19 rev = "v${version}";
20 hash = "sha256-9GUul5EoejcnCQqq1oX+seBtxttYIUhgcexaZk+7chk=";
21 };
22
23 cargoHash = "sha256-7cMd7pNWGV5DOSCLRW5fP3L1VnDTEsZZjhVz1AQLEXM=";
24
25 buildFeatures = lib.optional withTTS "tts";
26
27 nativeBuildInputs = [
28 pkg-config
29 rustPlatform.bindgenHook
30 ];
31
32 buildInputs = [
33 openssl
34 ]
35 ++ lib.optionals (withTTS && stdenv.hostPlatform.isLinux) [ speechd-minimal ]
36 ++ lib.optionals stdenv.hostPlatform.isLinux [ alsa-lib ];
37
38 checkFlags =
39 let
40 # Most of Blightmud's unit tests pass without trouble in the isolated
41 # Nixpkgs build env. The following tests need to be skipped.
42 skipList = [
43 "test_connect"
44 "test_gmcp_negotiation"
45 "test_ttype_negotiation"
46 "test_reconnect"
47 "test_is_connected"
48 "test_mud"
49 "test_server"
50 "test_lua_script"
51 "timer_test"
52 "validate_assertion_fail"
53 "regex_smoke_test"
54 "test_tls_init_verify_err"
55 "test_tls_init_no_verify"
56 "test_tls_init_verify"
57 ];
58 skipFlag = test: "--skip " + test;
59 in
60 builtins.concatStringsSep " " (builtins.map skipFlag skipList);
61
62 meta = with lib; {
63 description = "Terminal MUD client written in Rust";
64 mainProgram = "blightmud";
65 longDescription = ''
66 Blightmud is a terminal client for connecting to Multi User Dungeon (MUD)
67 games. It is written in Rust and supports TLS, GMCP, MSDP, MCCP2, tab
68 completion, text searching and a split view for scrolling. Blightmud can
69 be customized with Lua scripting for aliases, triggers, timers, customized
70 status bars, and more. Blightmud supports several accessibility features
71 including an optional built-in text-to-speech engine and a screen reader
72 friendly mode.
73 '';
74 homepage = "https://github.com/Blightmud/Blightmud";
75 license = licenses.gpl3Plus;
76 maintainers = with maintainers; [ cpu ];
77 platforms = platforms.linux ++ platforms.darwin;
78 };
79}