1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 meson,
6 ninja,
7 cmake,
8 pkg-config,
9 liblxi,
10 readline,
11 lua,
12 bash-completion,
13 wrapGAppsHook4,
14 glib,
15 gtk4,
16 gtksourceview5,
17 libadwaita,
18 json-glib,
19 desktop-file-utils,
20 appstream-glib,
21 gsettings-desktop-schemas,
22 withGui ? false,
23}:
24
25stdenv.mkDerivation rec {
26 pname = "lxi-tools";
27 version = "2.8";
28
29 src = fetchFromGitHub {
30 owner = "lxi-tools";
31 repo = "lxi-tools";
32 rev = "v${version}";
33 sha256 = "sha256-lmWZpKI3TXwF76LDFfZcOGUtPeBmBu+0Lu/3eCMMb3Y=";
34 };
35
36 nativeBuildInputs = [
37 meson
38 ninja
39 cmake
40 pkg-config
41 ]
42 ++ lib.optional withGui wrapGAppsHook4;
43
44 buildInputs = [
45 liblxi
46 readline
47 lua
48 bash-completion
49 ]
50 ++ lib.optionals withGui [
51 glib
52 gtk4
53 gtksourceview5
54 libadwaita
55 json-glib
56 desktop-file-utils
57 appstream-glib
58 gsettings-desktop-schemas
59 ];
60
61 postUnpack = "sed -i '/meson.add_install.*$/d' source/meson.build";
62
63 mesonFlags = lib.optional (!withGui) "-Dgui=false";
64
65 postInstall = lib.optionalString withGui "glib-compile-schemas $out/share/glib-2.0/schemas";
66
67 meta = with lib; {
68 description = "Tool for communicating with LXI compatible instruments";
69 longDescription = ''
70 lxi-tools is a collection of open source software tools
71 that enables control of LXI compatible instruments such
72 as modern oscilloscopes, power supplies,
73 spectrum analyzers etc.
74 '';
75 homepage = "https://lxi-tools.github.io/";
76 license = licenses.bsd3;
77 platforms = platforms.unix;
78 maintainers = [ maintainers.vq ];
79 mainProgram = "lxi";
80 };
81}