28 , opencascade-occt_7_6
38 , withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
39 , wxGTK-override ? null
42 opencascade-occt = opencascade-occt_7_6;
43 wxGTK-prusa = wxGTK32.overrideAttrs (old: rec {
44 pname = "wxwidgets-prusa3d-patched";
46 configureFlags = old.configureFlags ++ [ "--disable-glcanvasegl" ];
47 patches = [ ./wxWidgets-Makefile.in-fix.patch ];
48 src = fetchFromGitHub {
51 rev = "78aa2dc0ea7ce99dc19adc1140f74c3e2e3f3a26";
52 hash = "sha256-rYvmNmvv48JSKVT4ph9AS+JdstnLSRmcpWz1IdgBzQo=";
53 fetchSubmodules = true;
56 nanosvg-fltk = nanosvg.overrideAttrs (old: rec {
57 pname = "nanosvg-fltk";
58 version = "unstable-2022-12-22";
60 src = fetchFromGitHub {
63 rev = "abcd277ea45e9098bed752cf9c6875b533c0892f";
64 hash = "sha256-WNdAYu66ggpSYJ8Kt57yEA4mSTv+Rvzj9Rm1q765HpY=";
67 openvdb_tbb_2021_8 = openvdb.override { tbb = tbb_2021_11; };
68 wxGTK-override' = if wxGTK-override == null then wxGTK-prusa else wxGTK-override;
72 url = "https://raw.githubusercontent.com/gentoo/gentoo/master/media-gfx/prusaslicer/files/prusaslicer-2.8.0-missing-includes.patch";
73 hash = "sha256-/R9jv9zSP1lDW6IltZ8V06xyLdxfaYrk3zD6JRFUxHg=";
76 url = "https://raw.githubusercontent.com/gentoo/gentoo/master/media-gfx/prusaslicer/files/prusaslicer-2.8.0-fixed-linking.patch";
77 hash = "sha256-G1JNdVH+goBelag9aX0NctHFVqtoYFnqjwK/43FVgvM=";
81 stdenv.mkDerivation (finalAttrs: {
82 pname = "prusa-slicer";
86 src = fetchFromGitHub {
89 hash = "sha256-A/uxNIEXCchLw3t5erWdhqFAeh6nudcMfASi+RoJkFg=";
90 rev = "version_${finalAttrs.version}";
129 ] ++ lib.optionals withSystemd [
131 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
132 darwin.apple_sdk_11_0.frameworks.CoreWLAN
135 separateDebugInfo = true;
137 # The build system uses custom logic - defined in
138 # cmake/modules/FindNLopt.cmake in the package source - for finding the nlopt
139 # library, which doesn't pick up the package in the nix store. We
140 # additionally need to set the path via the NLOPT environment variable.
143 # prusa-slicer uses dlopen on `libudev.so` at runtime
144 NIX_LDFLAGS = lib.optionalString withSystemd "-ludev";
147 # Since version 2.5.0 of nlopt we need to link to libnlopt, as libnlopt_cxx
148 # now seems to be integrated into the main lib.
149 sed -i 's|nlopt_cxx|nlopt|g' cmake/modules/FindNLopt.cmake
151 # Disable slic3r_jobs_tests.cpp as the test fails sometimes
152 sed -i 's|slic3r_jobs_tests.cpp||g' tests/slic3rutils/CMakeLists.txt
154 # prusa-slicer expects the OCCTWrapper shared library in the same folder as
155 # the executable when loading STEP files. We force the loader to find it in
156 # the usual locations (i.e. LD_LIBRARY_PATH) instead. See the manpage
157 # dlopen(3) for context.
158 if [ -f "src/libslic3r/Format/STEP.cpp" ]; then
159 substituteInPlace src/libslic3r/Format/STEP.cpp \
160 --replace 'libpath /= "OCCTWrapper.so";' 'libpath = "OCCTWrapper.so";'
162 # https://github.com/prusa3d/PrusaSlicer/issues/9581
163 if [ -f "cmake/modules/FindEXPAT.cmake" ]; then
164 rm cmake/modules/FindEXPAT.cmake
167 # Fix resources folder location on macOS
168 substituteInPlace src/PrusaSlicer.cpp \
169 --replace "#ifdef __APPLE__" "#if 0"
179 ln -s "$out/bin/prusa-slicer" "$out/bin/prusa-gcodeviewer"
182 mv -v $out/bin/*.* $out/lib/
184 mkdir -p "$out/share/pixmaps/"
185 ln -s "$out/share/PrusaSlicer/icons/PrusaSlicer.png" "$out/share/pixmaps/PrusaSlicer.png"
186 ln -s "$out/share/PrusaSlicer/icons/PrusaSlicer-gcodeviewer_192px.png" "$out/share/pixmaps/PrusaSlicer-gcodeviewer.png"
191 --prefix LD_LIBRARY_PATH : "$out/lib"
201 --force-new-ctest-process \
202 -E 'libslic3r_tests|sla_print_tests'
208 description = "G-code generator for 3D printer";
209 homepage = "https://github.com/prusa3d/PrusaSlicer";
210 license = licenses.agpl3Plus;
211 maintainers = with maintainers; [ tweber tmarkus ];
212 platforms = platforms.unix;
213 } // lib.optionalAttrs (stdenv.hostPlatform.isDarwin) {
214 mainProgram = "PrusaSlicer";