1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 catch2,
6 cmake,
7 expected-lite,
8 fmt,
9 gsl-lite,
10 ninja,
11}:
12
13stdenv.mkDerivation rec {
14 pname = "bencode";
15 version = "1.0.1";
16
17 src = fetchFromGitHub {
18 owner = "fbdtemme";
19 repo = "bencode";
20 rev = version;
21 hash = "sha256-zpxvADZfYTUdlNLMZJSCanPL40EGl9BBCxR7oDhvOTw=";
22 };
23
24 nativeBuildInputs = [
25 cmake
26 ninja
27 ];
28
29 buildInputs = [
30 catch2
31 expected-lite
32 fmt
33 gsl-lite
34 ];
35
36 postPatch = ''
37 # Disable a test that requires an internet connection.
38 substituteInPlace tests/CMakeLists.txt \
39 --replace "add_subdirectory(cmake_fetch_content)" ""
40 '';
41
42 doCheck = true;
43
44 postInstall = ''
45 rm -rf $out/lib64
46 '';
47
48 meta = with lib; {
49 description = "Header-only C++20 bencode serialization/deserialization library";
50 homepage = "https://github.com/fbdtemme/bencode";
51 changelog = "https://github.com/fbdtemme/bencode/blob/${src.rev}/CHANGELOG.md";
52 license = licenses.mit;
53 maintainers = [ ];
54 platforms = platforms.unix;
55 # Broken because the default stdenv on these targets doesn't support C++20.
56 broken = with stdenv; isDarwin || (isLinux && isAarch64);
57 };
58}