22 version = "0-unstable-2024-10-10";
24 src = fetchFromGitHub {
27 rev = "71899313d36ce14de6646ef760fa6bbc5c0cc067";
28 hash = "sha256-bA+4wGAygdbHcOMGFwNyzn2daQ8E7NeOTUF2Tr3RQww=";
36 python.pkgs.pythonImportsCheckHook
46 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk_11_0.frameworks.Cocoa ];
49 substituteInPlace studio/src/guile/interpreter.cpp \
50 --replace '"libfive/bind/guile"' \
51 '"libfive/bind/guile:${placeholder "out"}/${guile.siteCcacheDir}"' \
52 --replace '(app_resource_dir + ":" + finder_build_dir).toLocal8Bit()' \
53 '"libfive/bind/guile:${placeholder "out"}/${guile.siteCcacheDir}"'
55 substituteInPlace libfive/bind/guile/CMakeLists.txt \
56 --replace "LIBFIVE_FRAMEWORK_DIR=$<TARGET_FILE_DIR:libfive>" \
57 "LIBFIVE_FRAMEWORK_DIR=$out/lib" \
58 --replace "LIBFIVE_STDLIB_DIR=$<TARGET_FILE_DIR:libfive-stdlib>" \
59 "LIBFIVE_STDLIB_DIR=$out/lib"
61 substituteInPlace libfive/bind/python/CMakeLists.txt \
62 --replace ' ''${PYTHON_SITE_PACKAGES_DIR}' \
63 " $out/${python.sitePackages}" \
65 substituteInPlace libfive/bind/python/libfive/ffi.py \
66 --replace "os.path.join('libfive', folder)" \
67 "os.path.join('$out/${python.sitePackages}/libfive', folder)" \
69 export XDG_CACHE_HOME=$(mktemp -d)/.cache
73 "-DGUILE_CCACHE_DIR=${placeholder "out"}/${guile.siteCcacheDir}"
76 env = lib.optionalAttrs stdenv.cc.isClang {
77 NIX_CFLAGS_COMPILE = "-Wno-error=enum-constexpr-conversion";
81 lib.optionalString stdenv.hostPlatform.isDarwin ''
82 # No rules to install the mac app, so do it manually.
83 mkdir -p $out/Applications
84 cp -r studio/Studio.app $out/Applications/Studio.app
86 install_name_tool -add_rpath $out/lib $out/Applications/Studio.app/Contents/MacOS/Studio
88 makeWrapper $out/Applications/Studio.app/Contents/MacOS/Studio $out/bin/Studio
91 # Link "Studio" binary to "libfive-studio" to be more obvious:
92 ln -s "$out/bin/Studio" "$out/bin/libfive-studio"
94 # Create links since libfive looks for the library in a specific path.
95 mkdir -p "$out/${python.sitePackages}/libfive/src"
96 ln -s "$out"/lib/libfive.* "$out/${python.sitePackages}/libfive/src/"
97 mkdir -p "$out/${python.sitePackages}/libfive/stdlib"
98 ln -s "$out"/lib/libfive-stdlib.* "$out/${python.sitePackages}/libfive/stdlib/"
100 # Create links so Studio can find the bindings.
101 mkdir -p "$out/libfive/bind"
102 ln -s "$out/${python.sitePackages}" "$out/libfive/bind/python"
105 pythonImportsCheck = [
112 passthru.updateScript = unstableGitUpdater {
117 description = "Infrastructure for solid modeling with F-Reps in C, C++, and Guile";
118 homepage = "https://libfive.com/";
119 maintainers = with maintainers; [
124 license = with licenses; [
128 platforms = with platforms; all;