Last active
August 23, 2024 17:38
-
-
Save ktemkin/a4837c01b23548dc473d3d88432c2be9 to your computer and use it in GitHub Desktop.
scopehal derivation + dependencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# scopehal apps, including glscopeclient and optionally ngscopeclient | |
# | |
# vim: et:ts=2:sw=2: | |
# | |
{ pkgs, lib, cmake, pkg-config, patchelf, ... }: | |
let | |
ffts = (pkgs.callPackage ./ffts.nix { }); | |
vulkan-sdk = (pkgs.callPackage ./vulkan-sdk.nix { }); | |
in | |
pkgs.stdenv.mkDerivation rec { | |
pname = "scopehal-apps"; | |
version = "git"; | |
# If this is set to true, we'll also install ngscopeclient. | |
includeUnstableNextGenClient = true; | |
src = pkgs.fetchgit { | |
url = "https://github.com/glscopeclient/scopehal-apps.git"; | |
rev = "617b6ee1230d19be4b883f676413664c3d7c0d7e"; | |
sha256 = "sha256-LJo1rcxDBYYngIU3+BiCV41HuQh/Ac/LG4wX9+IvVb8="; | |
fetchSubmodules = true; | |
}; | |
nativeBuildInputs = [ | |
cmake | |
pkg-config | |
patchelf | |
pkgs.git | |
]; | |
buildInputs = with pkgs; [ | |
ffts | |
shaderc | |
vulkan-sdk | |
# located via cmake module | |
glfw3 | |
glew | |
libyamlcpp | |
libpng | |
# pkg-config | |
gtkmm3 | |
pcre | |
pcre2 | |
util-linux | |
libselinux | |
libsepol | |
libthai | |
libdatrie | |
]; | |
cmakeFlags = [ "-DCMAKE_BUILD_TYPE=Release" ]; | |
patches = [ | |
# Fix a format string vulnerability that's preventing us from building with -Werror=format-security. | |
# Currently necessary due to https://github.com/glscopeclient/scopehal-apps/issues/571. | |
(pkgs.writeText "fix-format-security.patch" '' | |
--- scopehal-apps-0.0.1.orig/src/ngscopeclient/Dialog.cpp | |
+++ scopehal-apps-0.0.1/src/ngscopeclient/Dialog.cpp | |
@@ -207,7 +207,7 @@ void Dialog::HelpMarker(const string& he | |
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 50); | |
ImGui::TextUnformatted(header.c_str()); | |
for(auto s : bullets) | |
- ImGui::BulletText(s.c_str()); | |
+ ImGui::BulletText("%s", s.c_str()); | |
ImGui::PopTextWrapPos(); | |
ImGui::EndTooltip(); | |
} | |
'') | |
] | |
# If we're configured to, include ngscopeclient; though it's unstable enough that we | |
# won't create a desktop entry for it, yet. | |
++ lib.lists.optional (includeUnstableNextGenClient) (pkgs.writeText "install-ng-client.patch" '' | |
diff --git a/src/ngscopeclient/CMakeLists.txt b/src/ngscopeclient/CMakeLists.txt | |
index 79171e0..b340af1 100644 | |
--- a/src/ngscopeclient/CMakeLists.txt | |
+++ b/src/ngscopeclient/CMakeLists.txt | |
@@ -153,3 +153,11 @@ target_link_libraries(ngscopeclient | |
$${SIGCXX_LIBRARIES} | |
) | |
+ | |
+install(TARGETS ngscopeclient RUNTIME) | |
+install(DIRECTORY fonts | |
+ DESTINATION share/ngscopeclient) | |
+install(DIRECTORY shaders | |
+ DESTINATION share/ngscopeclient) | |
+install(DIRECTORY icons | |
+ DESTINATION share/ngscopeclient) | |
''); | |
# scopehal's cmake files expect to find vulkan libraries using the VULKAN_SDK environment variable. | |
# (The top level's vulkan can be specified with -DVulkan_LIBRARY, but the environment variable is still | |
# used by the lower layers; which makes it better just to use this, here. | |
preConfigure = "export VULKAN_SDK=${vulkan-sdk}"; | |
# Link our e.g. stylesheets into places that Qt is willing to find them. | |
# TODO: figure out if there's a build define that changes this | |
postInstall = '' | |
cp -r $out/share/glscopeclient/* $out/bin/ | |
cp -r $out/share/ngscopeclient/* $out/bin/ | |
''; | |
meta = { | |
description = "test and measurement tool control applications"; | |
longDescription = | |
'' Tools for remote controlling test and measurement tools. | |
Provides advanced visualization and decoding of output from oscilloscopes and control of various instruments. | |
''; | |
homepage = "https://www.antikernel.net/temp/glscopeclient-manual.pdf"; | |
license = pkgs.lib.licenses.bsd3; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# FFTS FFT library | |
# | |
# vim: et:ts=2:sw=2: | |
# | |
{ pkgs ? import <nixpkgs>, cmake, ... }: | |
pkgs.stdenv.mkDerivation rec { | |
pname = "ffts"; | |
version = "git"; | |
nativeBuildInputs = [ cmake ]; | |
src = pkgs.fetchFromGitHub { | |
owner = "anthonix"; | |
repo = "ffts"; | |
rev = "fe86885ecafd0d16eb122f3212403d1d5a86e24e"; | |
sha256 = "sha256-arBXkEbKGd0y6XpyynUSFQmNs7fndhEK7y1NNZI9MnI="; | |
}; | |
meta = { | |
description = "fast general-purpose FFT library"; | |
longDescription = | |
'' The 'fastest fourier transform' library in the south. | |
A FFT library that works almost anywhere. | |
''; | |
homepage = "https://github.com/anthonix/ffts"; | |
license = pkgs.lib.licenses.mit; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Vulkan SDK for Linux | |
# | |
# vim: et:ts=2:sw=2: | |
# | |
{ pkgs ? import <nixpkgs>, lib, stdenv, ... }: | |
pkgs.stdenv.mkDerivation rec { | |
pname = "vulkan-sdk"; | |
version = "1.3.224.1"; | |
src = pkgs.fetchzip { | |
url = "https://sdk.lunarg.com/sdk/download/${version}/linux/vulkansdk-linux-x86_64-${version}.tar.gz"; | |
sha256 = "sha256-XsMXXk+h3B/y8sITXlchYUHFbCBiPx16BIWn9rQVMDo="; | |
}; | |
# We only need to copy the SDK into place. | |
dontBuild = true; | |
dontConfigure = true; | |
# Select only the target architecture for this machine. | |
installPhase = '' | |
cp -r ${src}/${stdenv.targetPlatform.linuxArch} $out | |
''; | |
meta = { | |
description = "Vulkan SDK for Linux"; | |
homepage = "https://www.lunarg.com/vulkan-sdk/"; | |
license = lib.licenses.mit; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment