1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 cmake,
7 pkg-config,
8 fmt,
9 gtk3,
10 iir1,
11 imgui,
12 imnodes,
13 implot,
14 openssl,
15 curl,
16}:
17
18stdenv.mkDerivation {
19 pname = "implot-demos";
20 version = "unstable-2023-08-20";
21
22 src = fetchFromGitHub {
23 owner = "epezent";
24 repo = "implot_demos";
25 rev = "f33219d3ade192a2333d4a32e749842010952a29";
26 hash = "sha256-Xq0kVk8qncj/BzQyIX/l1OLvPSQJU8ckTxIIfLZdO/g=";
27 };
28
29 patches = [
30 # Resolve "undefined symbols" (GetWindowContentRegionWidth &c)
31 (fetchpatch {
32 url = "https://github.com/epezent/implot_demos/commit/85a59612c102f8da97d6ead04f528f4c88f4ef9a.patch";
33 hash = "sha256-HRhfC3TUwz9Mv+1ODabaDxTWUaj4Nx1iH7C6vjUPo2s=";
34 })
35
36 # CMake: make FetchContent optional, add install targets
37 (fetchpatch {
38 url = "https://github.com/epezent/implot_demos/commit/4add0433a46ed5e2099e1af1a77e8055e49230d0.patch";
39 hash = "sha256-jYdM8NuwbZk7INKo2wqMAbjLMTPdrAdM4Kr3xmtquIY=";
40 })
41
42 # CMake: link libGL from the "app" target
43 (fetchpatch {
44 url = "https://github.com/epezent/implot_demos/commit/6742e4202858eb85bd0d67ca5fa15a7a07e6b618.patch";
45 hash = "sha256-h4EJ9u1iHLYkGHgxSynskkuCGmY6mmvKdZSRwHJKerY=";
46 })
47 ];
48
49 cmakeFlags = [ (lib.cmakeBool "FETCHCONTENT_FULLY_DISCONNECTED" true) ];
50
51 nativeBuildInputs = [
52 cmake
53 pkg-config
54 ];
55
56 buildInputs = [
57 curl
58 fmt
59 iir1
60 imgui
61 imnodes
62 implot
63 openssl
64 ]
65 ++ lib.optionals stdenv.hostPlatform.isLinux [ gtk3 ];
66
67 meta = {
68 description = "Standalone ImPlot Demos";
69 homepage = "https://github.com/epezent/implot_demos";
70 broken =
71 stdenv.hostPlatform.isAarch64 # Target "mandel" relies on AVX2
72 || stdenv.hostPlatform.isDarwin;
73 license = lib.licenses.mit;
74 maintainers = with lib.maintainers; [ SomeoneSerge ];
75 mainProgram = "implot-demos";
76 platforms = lib.platforms.all;
77 };
78}