1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-17 19:21:04 +00:00
nixpkgs/pkgs/games/blightmud/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

81 lines
2.5 KiB
Nix

{ stdenv
, lib
, fetchFromGitHub
, rustPlatform
, pkg-config
, alsa-lib
, openssl
, withTTS ? false
, speechd-minimal
, darwin
}:
let
inherit (darwin.apple_sdk.frameworks)
CoreAudio AudioUnit AVFoundation AppKit;
in
rustPlatform.buildRustPackage rec {
pname = "blightmud";
version = "5.3.1";
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "v${version}";
hash = "sha256-9GUul5EoejcnCQqq1oX+seBtxttYIUhgcexaZk+7chk=";
};
cargoHash = "sha256-84m5dihmiEGrFCajqaMW05MQtBceLodBzqtjW+zh6kg=";
buildFeatures = lib.optional withTTS "tts";
nativeBuildInputs = [ pkg-config rustPlatform.bindgenHook ];
buildInputs = [ openssl ]
++ lib.optionals (withTTS && stdenv.hostPlatform.isLinux) [ speechd-minimal ]
++ lib.optionals stdenv.hostPlatform.isLinux [ alsa-lib ]
++ lib.optionals (withTTS && stdenv.hostPlatform.isDarwin) [ AVFoundation AppKit ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ CoreAudio AudioUnit ];
checkFlags =
let
# Most of Blightmud's unit tests pass without trouble in the isolated
# Nixpkgs build env. The following tests need to be skipped.
skipList = [
"test_connect"
"test_gmcp_negotiation"
"test_ttype_negotiation"
"test_reconnect"
"test_is_connected"
"test_mud"
"test_server"
"test_lua_script"
"timer_test"
"validate_assertion_fail"
"regex_smoke_test"
"test_tls_init_verify_err"
"test_tls_init_no_verify"
"test_tls_init_verify"
];
skipFlag = test: "--skip " + test;
in
builtins.concatStringsSep " " (builtins.map skipFlag skipList);
meta = with lib; {
description = "Terminal MUD client written in Rust";
mainProgram = "blightmud";
longDescription = ''
Blightmud is a terminal client for connecting to Multi User Dungeon (MUD)
games. It is written in Rust and supports TLS, GMCP, MSDP, MCCP2, tab
completion, text searching and a split view for scrolling. Blightmud can
be customized with Lua scripting for aliases, triggers, timers, customized
status bars, and more. Blightmud supports several accessibility features
including an optional built-in text-to-speech engine and a screen reader
friendly mode.
'';
homepage = "https://github.com/Blightmud/Blightmud";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ cpu ];
platforms = platforms.linux ++ platforms.darwin;
};
}