1{
2 lib,
3 stdenv,
4 fetchFromGitea,
5 cmake,
6 git,
7 pkg-config,
8 boost,
9 eigen_3_4_0,
10 glm,
11 libGL,
12 libpng,
13 openexr,
14 tbb,
15 xorg,
16 ilmbase,
17 llvmPackages,
18 unstableGitUpdater,
19}:
20
21stdenv.mkDerivation {
22 pname = "curv";
23 version = "0.5-unstable-2025-01-20";
24
25 src = fetchFromGitea {
26 domain = "codeberg.org";
27 owner = "doug-moen";
28 repo = "curv";
29 rev = "ef082c6612407dd8abce06015f9a16b1ebf661b8";
30 hash = "sha256-BGL07ZBA+ao3fg3qp56sVTe+3tM2SOp8TGu/jF7SVlM=";
31 fetchSubmodules = true;
32 };
33
34 strictDeps = true;
35 nativeBuildInputs = [
36 cmake
37 git
38 pkg-config
39 ];
40
41 buildInputs = [
42 boost
43 eigen_3_4_0
44 glm
45 libGL
46 libpng
47 openexr
48 tbb
49 xorg.libX11
50 xorg.libXcursor
51 xorg.libXext
52 xorg.libXi
53 xorg.libXinerama
54 xorg.libXrandr
55 ]
56 ++ lib.optionals stdenv.hostPlatform.isDarwin [
57 ilmbase
58 llvmPackages.openmp
59 ];
60
61 # force char to be unsigned on aarch64
62 # https://codeberg.org/doug-moen/curv/issues/227
63 NIX_CFLAGS_COMPILE = [ "-fsigned-char" ];
64
65 # GPU tests do not work in sandbox, instead we do this for sanity
66 doInstallCheck = true;
67 installCheckPhase = ''
68 runHook preInstallCheck
69 test "$(set -x; $out/bin/curv -x "2 + 2")" -eq "4"
70 runHook postInstallCheck
71 '';
72
73 passthru.updateScript = unstableGitUpdater { };
74
75 meta = with lib; {
76 description = "2D and 3D geometric modelling programming language for creating art with maths";
77 homepage = "https://codeberg.org/doug-moen/curv";
78 license = licenses.asl20;
79 platforms = platforms.all;
80 broken = stdenv.hostPlatform.isDarwin;
81 maintainers = with maintainers; [ pbsds ];
82 mainProgram = "curv";
83 };
84}