36 , withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
37 , wxGTK-override ? null
40 wxGTK-prusa = wxGTK32.overrideAttrs (old: rec {
41 pname = "wxwidgets-prusa3d-patched";
43 configureFlags = old.configureFlags ++ [ "--disable-glcanvasegl" ];
44 patches = [ ./wxWidgets-Makefile.in-fix.patch ];
45 src = fetchFromGitHub {
48 rev = "78aa2dc0ea7ce99dc19adc1140f74c3e2e3f3a26";
49 hash = "sha256-rYvmNmvv48JSKVT4ph9AS+JdstnLSRmcpWz1IdgBzQo=";
50 fetchSubmodules = true;
53 nanosvg-fltk = nanosvg.overrideAttrs (old: rec {
54 pname = "nanosvg-fltk";
55 version = "unstable-2022-12-22";
57 src = fetchFromGitHub {
60 rev = "abcd277ea45e9098bed752cf9c6875b533c0892f";
61 hash = "sha256-WNdAYu66ggpSYJ8Kt57yEA4mSTv+Rvzj9Rm1q765HpY=";
64 openvdb_tbb_2021_8 = openvdb.overrideAttrs (old: rec {
65 buildInputs = [ openexr boost tbb_2021_8 jemalloc c-blosc ilmbase ];
67 wxGTK-override' = if wxGTK-override == null then wxGTK-prusa else wxGTK-override;
69 stdenv.mkDerivation (finalAttrs: {
70 pname = "prusa-slicer";
105 ] ++ lib.optionals withSystemd [
109 separateDebugInfo = true;
111 # The build system uses custom logic - defined in
112 # cmake/modules/FindNLopt.cmake in the package source - for finding the nlopt
113 # library, which doesn't pick up the package in the nix store. We
114 # additionally need to set the path via the NLOPT environment variable.
117 # prusa-slicer uses dlopen on `libudev.so` at runtime
118 NIX_LDFLAGS = lib.optionalString withSystemd "-ludev";
121 # Since version 2.5.0 of nlopt we need to link to libnlopt, as libnlopt_cxx
122 # now seems to be integrated into the main lib.
123 sed -i 's|nlopt_cxx|nlopt|g' cmake/modules/FindNLopt.cmake
125 # Disable slic3r_jobs_tests.cpp as the test fails sometimes
126 sed -i 's|slic3r_jobs_tests.cpp||g' tests/slic3rutils/CMakeLists.txt
128 # prusa-slicer expects the OCCTWrapper shared library in the same folder as
129 # the executable when loading STEP files. We force the loader to find it in
130 # the usual locations (i.e. LD_LIBRARY_PATH) instead. See the manpage
131 # dlopen(3) for context.
132 if [ -f "src/libslic3r/Format/STEP.cpp" ]; then
133 substituteInPlace src/libslic3r/Format/STEP.cpp \
134 --replace 'libpath /= "OCCTWrapper.so";' 'libpath = "OCCTWrapper.so";'
136 # https://github.com/prusa3d/PrusaSlicer/issues/9581
137 if [ -f "cmake/modules/FindEXPAT.cmake" ]; then
138 rm cmake/modules/FindEXPAT.cmake
141 # Fix resources folder location on macOS
142 substituteInPlace src/PrusaSlicer.cpp \
143 --replace "#ifdef __APPLE__" "#if 0"
147 # wxWidgets: CheckResizerFlags assert fix
149 url = "https://github.com/prusa3d/PrusaSlicer/commit/24a5ebd65c9d25a0fd69a3716d079fd1b00eb15c.patch";
150 hash = "sha256-MNGtaI7THu6HEl9dMwcO1hkrCtIkscoNh4ulA2cKtZA=";
154 src = fetchFromGitHub {
156 repo = "PrusaSlicer";
157 hash = "sha256-t5lnBL7SZVfyR680ZK29YXgE3pag+uVv4+BGJZq40/A=";
158 rev = "version_${finalAttrs.version}";
168 ln -s "$out/bin/prusa-slicer" "$out/bin/prusa-gcodeviewer"
171 mv -v $out/bin/*.* $out/lib/
173 mkdir -p "$out/share/pixmaps/"
174 ln -s "$out/share/PrusaSlicer/icons/PrusaSlicer.png" "$out/share/pixmaps/PrusaSlicer.png"
175 ln -s "$out/share/PrusaSlicer/icons/PrusaSlicer-gcodeviewer_192px.png" "$out/share/pixmaps/PrusaSlicer-gcodeviewer.png"
180 --prefix LD_LIBRARY_PATH : "$out/lib"
190 --force-new-ctest-process \
191 -E 'libslic3r_tests|sla_print_tests'
197 description = "G-code generator for 3D printer";
198 homepage = "https://github.com/prusa3d/PrusaSlicer";
199 license = licenses.agpl3;
200 maintainers = with maintainers; [ moredread tweber tmarkus ];
201 } // lib.optionalAttrs (stdenv.isDarwin) {
202 mainProgram = "PrusaSlicer";