1{
2 lib,
3 fetchFromGitLab,
4 rustPlatform,
5 pkg-config,
6 openssl,
7 wayland,
8 autoPatchelfHook,
9 libxkbcommon,
10 libGL,
11 libX11,
12 libXcursor,
13 libXi,
14 stdenv,
15 makeWrapper,
16 zenity,
17}:
18rustPlatform.buildRustPackage rec {
19 pname = "surfer";
20 version = "0.3.0";
21
22 src = fetchFromGitLab {
23 owner = "surfer-project";
24 repo = "surfer";
25 rev = "v${version}";
26 hash = "sha256-mvHyljAEVi1FMkEbKsPmCNx2Cg0/Ydw3ZQCZsowEKGc=";
27 fetchSubmodules = true;
28 };
29
30 nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [
31 pkg-config
32 autoPatchelfHook
33 makeWrapper
34 ];
35
36 buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
37 openssl
38 (lib.getLib stdenv.cc.cc)
39 ];
40
41 # Wayland and X11 libs are required at runtime since winit uses dlopen
42 runtimeDependencies = lib.optionals stdenv.hostPlatform.isLinux [
43 wayland
44 libxkbcommon
45 libGL
46 libX11
47 libXcursor
48 libXi
49 ];
50
51 cargoHash = "sha256-89pkHS0YQ77PmQfT8epdu2tPRNAenYGgtoiJVuuVYiI=";
52
53 # Avoid the network attempt from skia. See: https://github.com/cargo2nix/cargo2nix/issues/318
54 doCheck = false;
55
56 postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
57 wrapProgram $out/bin/surfer \
58 --prefix PATH : ${lib.makeBinPath [ zenity ]}
59 '';
60
61 meta = {
62 description = "Extensible and Snappy Waveform Viewer";
63 homepage = "https://surfer-project.org/";
64 changelog = "https://gitlab.com/surfer-project/surfer/-/releases/v${version}";
65 license = lib.licenses.eupl12;
66 maintainers = with lib.maintainers; [ hakan-demirli ];
67 platforms = lib.platforms.linux ++ lib.platforms.darwin;
68 mainProgram = "surfer";
69 };
70}