2022-06-26 10:26:21 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2023-07-15 17:15:38 +00:00
|
|
|
, openexr
|
|
|
|
, jemalloc
|
|
|
|
, c-blosc
|
2022-06-26 10:26:21 +00:00
|
|
|
, binutils
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, pkg-config
|
|
|
|
, wrapGAppsHook
|
|
|
|
, boost
|
|
|
|
, cereal
|
|
|
|
, cgal_5
|
|
|
|
, curl
|
|
|
|
, dbus
|
|
|
|
, eigen
|
|
|
|
, expat
|
|
|
|
, glew
|
|
|
|
, glib
|
|
|
|
, gmp
|
|
|
|
, gtk3
|
|
|
|
, hicolor-icon-theme
|
|
|
|
, ilmbase
|
|
|
|
, libpng
|
|
|
|
, mpfr
|
2023-07-15 17:15:38 +00:00
|
|
|
, nanosvg
|
2022-06-26 10:26:21 +00:00
|
|
|
, nlopt
|
2022-09-11 15:47:08 +00:00
|
|
|
, opencascade-occt
|
2022-06-26 10:26:21 +00:00
|
|
|
, openvdb
|
|
|
|
, pcre
|
|
|
|
, qhull
|
2023-07-15 17:15:38 +00:00
|
|
|
, tbb_2021_8
|
|
|
|
, wxGTK32
|
2022-06-26 10:26:21 +00:00
|
|
|
, xorg
|
|
|
|
, fetchpatch
|
2023-02-02 18:25:31 +00:00
|
|
|
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
|
2023-08-10 07:59:29 +00:00
|
|
|
, wxGTK-override ? null
|
2022-06-26 10:26:21 +00:00
|
|
|
}:
|
2022-06-16 17:23:12 +00:00
|
|
|
let
|
2023-07-15 17:15:38 +00:00
|
|
|
wxGTK-prusa = wxGTK32.overrideAttrs (old: rec {
|
2022-06-16 17:23:12 +00:00
|
|
|
pname = "wxwidgets-prusa3d-patched";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "3.2.0";
|
|
|
|
configureFlags = old.configureFlags ++ [ "--disable-glcanvasegl" ];
|
|
|
|
patches = [ ./wxWidgets-Makefile.in-fix.patch ];
|
2022-06-16 17:23:12 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "prusa3d";
|
|
|
|
repo = "wxWidgets";
|
2023-07-15 17:15:38 +00:00
|
|
|
rev = "78aa2dc0ea7ce99dc19adc1140f74c3e2e3f3a26";
|
|
|
|
hash = "sha256-rYvmNmvv48JSKVT4ph9AS+JdstnLSRmcpWz1IdgBzQo=";
|
2022-06-16 17:23:12 +00:00
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
});
|
2023-07-15 17:15:38 +00:00
|
|
|
nanosvg-fltk = nanosvg.overrideAttrs (old: rec {
|
|
|
|
pname = "nanosvg-fltk";
|
|
|
|
version = "unstable-2022-12-22";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "fltk";
|
|
|
|
repo = "nanosvg";
|
|
|
|
rev = "abcd277ea45e9098bed752cf9c6875b533c0892f";
|
|
|
|
hash = "sha256-WNdAYu66ggpSYJ8Kt57yEA4mSTv+Rvzj9Rm1q765HpY=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
openvdb_tbb_2021_8 = openvdb.overrideAttrs (old: rec {
|
|
|
|
buildInputs = [ openexr boost tbb_2021_8 jemalloc c-blosc ilmbase ];
|
|
|
|
});
|
2023-08-10 07:59:29 +00:00
|
|
|
wxGTK-override' = if wxGTK-override == null then wxGTK-prusa else wxGTK-override;
|
2022-06-26 10:26:21 +00:00
|
|
|
in
|
2023-10-09 19:29:22 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "prusa-slicer";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "2.6.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
|
|
|
wrapGAppsHook
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2022-06-26 10:26:21 +00:00
|
|
|
binutils
|
2020-04-24 23:36:52 +00:00
|
|
|
boost
|
|
|
|
cereal
|
|
|
|
cgal_5
|
|
|
|
curl
|
2021-02-05 17:12:51 +00:00
|
|
|
dbus
|
2020-04-24 23:36:52 +00:00
|
|
|
eigen
|
|
|
|
expat
|
|
|
|
glew
|
2021-02-05 17:12:51 +00:00
|
|
|
glib
|
2020-04-24 23:36:52 +00:00
|
|
|
gmp
|
2021-02-05 17:12:51 +00:00
|
|
|
gtk3
|
|
|
|
hicolor-icon-theme
|
2020-04-24 23:36:52 +00:00
|
|
|
ilmbase
|
|
|
|
libpng
|
|
|
|
mpfr
|
2023-07-15 17:15:38 +00:00
|
|
|
nanosvg-fltk
|
2020-04-24 23:36:52 +00:00
|
|
|
nlopt
|
2022-09-11 15:47:08 +00:00
|
|
|
opencascade-occt
|
2023-07-15 17:15:38 +00:00
|
|
|
openvdb_tbb_2021_8
|
2021-02-05 17:12:51 +00:00
|
|
|
pcre
|
2023-07-15 17:15:38 +00:00
|
|
|
qhull
|
|
|
|
tbb_2021_8
|
2023-08-10 07:59:29 +00:00
|
|
|
wxGTK-override'
|
2020-04-24 23:36:52 +00:00
|
|
|
xorg.libX11
|
2022-12-02 08:20:57 +00:00
|
|
|
] ++ lib.optionals withSystemd [
|
|
|
|
systemd
|
2023-11-16 04:20:00 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-30 13:39:12 +00:00
|
|
|
separateDebugInfo = true;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# The build system uses custom logic - defined in
|
|
|
|
# cmake/modules/FindNLopt.cmake in the package source - for finding the nlopt
|
|
|
|
# library, which doesn't pick up the package in the nix store. We
|
|
|
|
# additionally need to set the path via the NLOPT environment variable.
|
|
|
|
NLOPT = nlopt;
|
|
|
|
|
|
|
|
# prusa-slicer uses dlopen on `libudev.so` at runtime
|
2022-12-02 08:20:57 +00:00
|
|
|
NIX_LDFLAGS = lib.optionalString withSystemd "-ludev";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
prePatch = ''
|
|
|
|
# Since version 2.5.0 of nlopt we need to link to libnlopt, as libnlopt_cxx
|
|
|
|
# now seems to be integrated into the main lib.
|
|
|
|
sed -i 's|nlopt_cxx|nlopt|g' cmake/modules/FindNLopt.cmake
|
2022-08-21 13:32:41 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# Disable slic3r_jobs_tests.cpp as the test fails sometimes
|
|
|
|
sed -i 's|slic3r_jobs_tests.cpp||g' tests/slic3rutils/CMakeLists.txt
|
2022-10-06 18:32:54 +00:00
|
|
|
|
|
|
|
# prusa-slicer expects the OCCTWrapper shared library in the same folder as
|
|
|
|
# the executable when loading STEP files. We force the loader to find it in
|
|
|
|
# the usual locations (i.e. LD_LIBRARY_PATH) instead. See the manpage
|
|
|
|
# dlopen(3) for context.
|
|
|
|
if [ -f "src/libslic3r/Format/STEP.cpp" ]; then
|
|
|
|
substituteInPlace src/libslic3r/Format/STEP.cpp \
|
|
|
|
--replace 'libpath /= "OCCTWrapper.so";' 'libpath = "OCCTWrapper.so";'
|
|
|
|
fi
|
2023-07-15 17:15:38 +00:00
|
|
|
# https://github.com/prusa3d/PrusaSlicer/issues/9581
|
|
|
|
if [ -f "cmake/modules/FindEXPAT.cmake" ]; then
|
|
|
|
rm cmake/modules/FindEXPAT.cmake
|
|
|
|
fi
|
2022-12-02 08:20:57 +00:00
|
|
|
|
|
|
|
# Fix resources folder location on macOS
|
|
|
|
substituteInPlace src/PrusaSlicer.cpp \
|
|
|
|
--replace "#ifdef __APPLE__" "#if 0"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
patches = [
|
|
|
|
# wxWidgets: CheckResizerFlags assert fix
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/prusa3d/PrusaSlicer/commit/24a5ebd65c9d25a0fd69a3716d079fd1b00eb15c.patch";
|
|
|
|
hash = "sha256-MNGtaI7THu6HEl9dMwcO1hkrCtIkscoNh4ulA2cKtZA=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "prusa3d";
|
|
|
|
repo = "PrusaSlicer";
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-t5lnBL7SZVfyR680ZK29YXgE3pag+uVv4+BGJZq40/A=";
|
|
|
|
rev = "version_${finalAttrs.version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
cmakeFlags = [
|
2022-12-02 08:20:57 +00:00
|
|
|
"-DSLIC3R_STATIC=0"
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DSLIC3R_FHS=1"
|
2021-02-05 17:12:51 +00:00
|
|
|
"-DSLIC3R_GTK=3"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
2021-02-05 17:12:51 +00:00
|
|
|
ln -s "$out/bin/prusa-slicer" "$out/bin/prusa-gcodeviewer"
|
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
mkdir -p "$out/lib"
|
2022-12-02 08:20:57 +00:00
|
|
|
mv -v $out/bin/*.* $out/lib/
|
2022-10-06 18:32:54 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir -p "$out/share/pixmaps/"
|
|
|
|
ln -s "$out/share/PrusaSlicer/icons/PrusaSlicer.png" "$out/share/pixmaps/PrusaSlicer.png"
|
2021-02-05 17:12:51 +00:00
|
|
|
ln -s "$out/share/PrusaSlicer/icons/PrusaSlicer-gcodeviewer_192px.png" "$out/share/pixmaps/PrusaSlicer-gcodeviewer.png"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
preFixup = ''
|
|
|
|
gappsWrapperArgs+=(
|
|
|
|
--prefix LD_LIBRARY_PATH : "$out/lib"
|
|
|
|
)
|
|
|
|
'';
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
ctest \
|
|
|
|
--force-new-ctest-process \
|
|
|
|
-E 'libslic3r_tests|sla_print_tests'
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "G-code generator for 3D printer";
|
|
|
|
homepage = "https://github.com/prusa3d/PrusaSlicer";
|
|
|
|
license = licenses.agpl3;
|
2023-11-16 04:20:00 +00:00
|
|
|
maintainers = with maintainers; [ moredread tweber tmarkus ];
|
2023-01-11 07:51:40 +00:00
|
|
|
} // lib.optionalAttrs (stdenv.isDarwin) {
|
|
|
|
mainProgram = "PrusaSlicer";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-10-09 19:29:22 +00:00
|
|
|
})
|