nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 cmake,
6 pkg-config,
7 gtkmm3,
8 cairomm,
9 yaml-cpp,
10 glfw,
11 libtirpc,
12 liblxi,
13 libsigcxx,
14 glew,
15 zstd,
16 wrapGAppsHook3,
17 makeBinaryWrapper,
18 writeDarwinBundle,
19 shaderc,
20 vulkan-headers,
21 vulkan-loader,
22 vulkan-tools,
23 glslang,
24 spirv-tools,
25 ffts,
26 moltenvk,
27 llvmPackages,
28 hidapi,
29}:
30
31let
32 pname = "scopehal-apps";
33 version = "0.1";
34in
35stdenv.mkDerivation {
36 pname = "${pname}";
37 version = "${version}";
38
39 src = fetchFromGitHub {
40 owner = "ngscopeclient";
41 repo = "${pname}";
42 tag = "v${version}";
43 hash = "sha256-AfO6JaWA9ECMI6FkMg/LaAG4QMeZmG9VxHiw0dSJYNM=";
44 fetchSubmodules = true;
45 };
46
47 strictDeps = true;
48
49 nativeBuildInputs = [
50 cmake
51 pkg-config
52 shaderc
53 spirv-tools
54 ]
55 ++ lib.optionals stdenv.hostPlatform.isLinux [
56 wrapGAppsHook3
57 ]
58 ++ lib.optionals stdenv.hostPlatform.isDarwin [
59 makeBinaryWrapper
60 writeDarwinBundle
61 ];
62
63 buildInputs = [
64 cairomm
65 glew
66 glfw
67 glslang
68 liblxi
69 libsigcxx
70 vulkan-headers
71 vulkan-loader
72 vulkan-tools
73 yaml-cpp
74 zstd
75 hidapi
76 ]
77 ++ lib.optionals stdenv.hostPlatform.isLinux [
78 ffts
79 gtkmm3
80 libtirpc
81 ]
82 ++ lib.optionals stdenv.cc.isClang [ llvmPackages.openmp ]
83 ++ lib.optionals stdenv.hostPlatform.isDarwin [
84 moltenvk
85 ];
86
87 cmakeFlags = [
88 "-DNGSCOPECLIENT_VERSION=${version}"
89 ];
90
91 env.NIX_CFLAGS_COMPILE = toString [
92 # error: variable 'empty_string' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
93 "-Wno-error=uninitialized"
94 ];
95
96 patches = [
97 ./remove-git-derived-version.patch
98 ]
99 ++ lib.optionals stdenv.hostPlatform.isDarwin [
100 ./remove-brew-molten-vk-lookup.patch
101 ];
102
103 postFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
104 mv -v $out/bin/ngscopeclient $out/bin/.ngscopeclient-unwrapped
105 makeWrapper $out/bin/.ngscopeclient-unwrapped $out/bin/ngscopeclient \
106 --prefix DYLD_LIBRARY_PATH : "${lib.makeLibraryPath [ vulkan-loader ]}"
107 '';
108
109 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
110 mkdir -p $out/Applications/ngscopeclient.app/Contents/{MacOS,Resources}
111
112 install -m644 {../src/ngscopeclient/icons/macos,$out/Applications/ngscopeclient.app/Contents/Resources}/ngscopeclient.icns
113
114 write-darwin-bundle $out ngscopeclient ngscopeclient ngscopeclient
115 '';
116
117 meta = {
118 description = "Advanced test & measurement remote control and analysis suite";
119 homepage = "https://www.ngscopeclient.org/";
120 license = lib.licenses.bsd3;
121 mainProgram = "ngscopeclient";
122 maintainers = with lib.maintainers; [
123 bgamari
124 carlossless
125 ];
126 platforms = lib.platforms.linux ++ lib.platforms.darwin;
127 };
128}