nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 cmake,
7 help2man,
8 gzip,
9 libXt,
10 openusd,
11 onetbb,
12 vtk,
13 autoPatchelfHook,
14 python3Packages,
15 opencascade-occt,
16 assimp,
17 fontconfig,
18 withManual ? !stdenv.hostPlatform.isDarwin,
19 withPythonBinding ? false,
20 withUsd ? openusd.meta.available,
21}:
22
23stdenv.mkDerivation rec {
24 pname = "f3d";
25 version = "3.4.1";
26
27 outputs = [ "out" ] ++ lib.optionals withManual [ "man" ];
28
29 src = fetchFromGitHub {
30 owner = "f3d-app";
31 repo = "f3d";
32 tag = "v${version}";
33 hash = "sha256-2Kcy9CF0K9jBfVc944i289jbMQdQWXW+gOiaHHchF6U=";
34 fetchLFS = true;
35 };
36
37 nativeBuildInputs = [
38 cmake
39 ]
40 ++ lib.optionals withManual [
41 # manpage
42 help2man
43 gzip
44 ]
45 ++ lib.optionals stdenv.hostPlatform.isElf [
46 # https://github.com/f3d-app/f3d/pull/1217
47 autoPatchelfHook
48 ];
49
50 buildInputs = [
51 vtk
52 opencascade-occt
53 assimp
54 fontconfig
55 ]
56 ++ lib.optionals withPythonBinding [
57 python3Packages.python
58 # Using C++ header files, not Python import
59 python3Packages.pybind11
60 ]
61 ++ lib.optionals withUsd [
62 libXt
63 openusd
64 onetbb
65 ];
66
67 cmakeFlags = [
68 # conflict between VTK and Nixpkgs;
69 # see https://github.com/NixOS/nixpkgs/issues/89167
70 "-DCMAKE_INSTALL_LIBDIR=lib"
71 "-DCMAKE_INSTALL_INCLUDEDIR=include"
72 "-DCMAKE_INSTALL_BINDIR=bin"
73 "-DF3D_MODULE_EXTERNAL_RENDERING=ON"
74 "-DF3D_PLUGIN_BUILD_ASSIMP=ON"
75 "-DF3D_PLUGIN_BUILD_OCCT=ON"
76 ]
77 ++ lib.optionals withManual [
78 "-DF3D_LINUX_GENERATE_MAN=ON"
79 ]
80 ++ lib.optionals withPythonBinding [
81 "-DF3D_BINDINGS_PYTHON=ON"
82 ]
83 ++ lib.optionals withUsd [
84 "-DF3D_PLUGIN_BUILD_USD=ON"
85 ];
86
87 meta = {
88 description = "Fast and minimalist 3D viewer using VTK";
89 homepage = "https://f3d-app.github.io/f3d";
90 changelog = "https://github.com/f3d-app/f3d/releases/tag/v${version}";
91 license = lib.licenses.bsd3;
92 maintainers = with lib.maintainers; [
93 bcdarwin
94 pbsds
95 ];
96 platforms = with lib.platforms; unix;
97 mainProgram = "f3d";
98 };
99}