nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 pkg-config,
7 pffft,
8 libpcap,
9 libusb1,
10 python3,
11 qt5,
12}:
13
14stdenv.mkDerivation (finalAttrs: {
15 pname = "hobbits";
16 version = "0.55.0";
17
18 src = fetchFromGitHub {
19 owner = "Mahlet-Inc";
20 repo = "hobbits";
21 tag = "v${finalAttrs.version}";
22 hash = "sha256-W6QBLj+GkmM88cOVSIc1PLiVXysjv74J7citFW6SRDM=";
23 };
24
25 postPatch = ''
26 substituteInPlace src/hobbits-core/settingsdata.cpp \
27 --replace-warn "pythonHome = \"/usr\"" "pythonHome = \"${python3}\""
28 substituteInPlace cmake/gitversion.cmake \
29 --replace-warn "[Mystery Build]" "${finalAttrs.version}"
30 substituteInPlace CMakeLists.txt \
31 --replace-warn "SELF_CONTAINED_APP OR APPLE" "SELF_CONTAINED_APP"
32 '';
33
34 buildInputs = [
35 pffft
36 libpcap
37 libusb1
38 python3
39 ];
40
41 nativeBuildInputs = [
42 cmake
43 pkg-config
44 qt5.wrapQtAppsHook
45 ];
46
47 cmakeFlags = [ (lib.cmakeBool "USE_SYSTEM_PFFFT" true) ];
48
49 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isAarch64 "-Wno-error=narrowing";
50
51 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
52 mkdir -p $out/{Applications,bin}
53 mv $out/hobbits.app $out/Applications
54 wrapProgram $out/Applications/hobbits.app/Contents/MacOS/hobbits \
55 --prefix DYLD_LIBRARY_PATH : $out/Applications/hobbits.app/Contents/Frameworks
56 ln -s $out/Applications/hobbits.app/Contents/MacOS/hobbits $out/bin/hobbits
57 # Prevent wrapping
58 find $out/Applications -type f -name "*.dylib" -exec chmod -x {} \;
59 '';
60
61 meta = {
62 description = "Multi-platform GUI for bit-based analysis, processing, and visualization";
63 homepage = "https://github.com/Mahlet-Inc/hobbits";
64 license = lib.licenses.mit;
65 maintainers = with lib.maintainers; [ sikmir ];
66 platforms = with lib.platforms; linux ++ darwin;
67 };
68})