1{
2 lib,
3 stdenv,
4 qtbase,
5 qtdeclarative,
6 fetchFromGitHub,
7 cmake,
8 pkg-config,
9 box2d,
10 unstableGitUpdater,
11}:
12
13let
14 inherit (lib) cmakeBool;
15
16 # 2.3.1 is the only supported version
17 box2d' = box2d.overrideAttrs (old: rec {
18 version = "2.3.1";
19 src = fetchFromGitHub {
20 owner = "erincatto";
21 repo = "box2d";
22 tag = "v${version}";
23 hash = "sha256-Z2J17YMzQNZqABIa5eyJDT7BWfXveymzs+DWsrklPIs=";
24 };
25 patches = [ ];
26 postPatch = "";
27 sourceRoot = "${src.name}/Box2D";
28 cmakeFlags = old.cmakeFlags or [ ] ++ [
29 (cmakeBool "BOX2D_INSTALL" true)
30 (cmakeBool "BOX2D_BUILD_SHARED" true)
31 (cmakeBool "BOX2D_BUILD_EXAMPLES" false)
32 ];
33 });
34
35in
36stdenv.mkDerivation {
37 pname = "qml-box2d";
38 version = "0-unstable-2024-04-15";
39
40 src = fetchFromGitHub {
41 owner = "qml-box2d";
42 repo = "qml-box2d";
43 rev = "3a85439726d1ac4d082308feba45f23859ba71e0";
44 hash = "sha256-lTgzPJWSwNfPRj5Lc63C69o4ILuyhVRLvltTo5E7yq0=";
45 };
46
47 dontWrapQtApps = true;
48
49 nativeBuildInputs = [
50 cmake
51 pkg-config
52 ];
53
54 buildInputs = [
55 box2d'
56 qtbase
57 qtdeclarative
58 ];
59
60 cmakeFlags = [
61 (cmakeBool "USE_SYSTEM_BOX2D" true)
62 ];
63
64 passthru = {
65 updateScript = unstableGitUpdater {
66 hardcodeZeroVersion = true;
67 };
68 };
69
70 meta = {
71 description = "QML plugin for Box2D engine";
72 homepage = "https://github.com/qml-box2d/qml-box2d";
73 maintainers = with lib.maintainers; [ guibou ];
74 platforms = lib.platforms.linux;
75 license = lib.licenses.zlib;
76 };
77}