summaryrefslogtreecommitdiff
path: root/pkgs/by-name/cr/crusader/package.nix
blob: 057accbabd86940276239a4a4400394005b18660 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{
  lib,
  stdenv,
  rustPlatform,
  fetchFromGitHub,

  # nativeBuildInputs
  makeWrapper,
  pkg-config,
  autoPatchelfHook,

  # buildInputs
  fontconfig,
  libgcc,
  libxkbcommon,
  xorg,

  libGL,
  wayland,
  versionCheckHook,
  nix-update-script,
}:
rustPlatform.buildRustPackage rec {
  pname = "crusader";
  version = "0.3.2";

  src = fetchFromGitHub {
    owner = "Zoxc";
    repo = "crusader";
    tag = "v${version}";
    hash = "sha256-M5zMOOYDS91p0EuDSlQ3K6eiVQpbX6953q+cXBMix2s=";
  };

  sourceRoot = "${src.name}/src";

  useFetchCargoVendor = true;
  cargoHash = "sha256-f0TWiRX203/gNsa9UEr/1Bv+kUxLAK/Zlw+S693xZlE=";

  # autoPatchelfHook required on linux for crusader-gui
  nativeBuildInputs =
    [
      makeWrapper
      pkg-config
    ]
    ++ lib.optionals stdenv.hostPlatform.isLinux [
      autoPatchelfHook
    ];

  buildInputs =
    [
      fontconfig
      libgcc
      libxkbcommon
    ]
    ++ lib.optionals stdenv.hostPlatform.isLinux [
      xorg.libX11
      xorg.libXcursor
      xorg.libXi
    ];

  # required for crusader-gui
  runtimeDependencies = [
    libGL
    libxkbcommon
  ];

  postFixup = ''
    # the program looks for libwayland-client.so at runtime
    wrapProgram $out/bin/crusader-gui \
      --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ wayland ]}
  '';

  nativeInstallCheckInputs = [
    versionCheckHook
  ];
  versionCheckProgramArg = "--version";
  doInstallCheck = true;

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "Network throughput and latency tester";
    homepage = "https://github.com/Zoxc/crusader";
    changelog = "https://github.com/Zoxc/crusader/blob/v${version}/CHANGELOG.md";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ x123 ];
    platforms = lib.platforms.all;
    mainProgram = "crusader";
  };
}