2022-06-26 10:26:21 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, binutils
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, pkg-config
|
|
|
|
, wrapGAppsHook
|
|
|
|
, boost
|
|
|
|
, cereal
|
|
|
|
, cgal_5
|
|
|
|
, curl
|
|
|
|
, dbus
|
|
|
|
, eigen
|
|
|
|
, expat
|
|
|
|
, glew
|
|
|
|
, glib
|
|
|
|
, gmp
|
|
|
|
, gtest
|
|
|
|
, gtk3
|
|
|
|
, hicolor-icon-theme
|
|
|
|
, ilmbase
|
|
|
|
, libpng
|
|
|
|
, mpfr
|
|
|
|
, nlopt
|
2022-09-11 15:47:08 +00:00
|
|
|
, opencascade-occt
|
2022-06-26 10:26:21 +00:00
|
|
|
, openvdb
|
|
|
|
, pcre
|
|
|
|
, qhull
|
|
|
|
, systemd
|
|
|
|
, tbb
|
2022-10-30 15:09:59 +00:00
|
|
|
, wxGTK31
|
2022-06-26 10:26:21 +00:00
|
|
|
, xorg
|
|
|
|
, fetchpatch
|
2022-12-02 08:20:57 +00:00
|
|
|
, withSystemd ? stdenv.isLinux
|
2022-06-26 10:26:21 +00:00
|
|
|
}:
|
2022-06-16 17:23:12 +00:00
|
|
|
let
|
2022-12-02 08:20:57 +00:00
|
|
|
wxGTK-prusa = wxGTK31.overrideAttrs (old: rec {
|
2022-06-16 17:23:12 +00:00
|
|
|
pname = "wxwidgets-prusa3d-patched";
|
|
|
|
version = "3.1.4";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "prusa3d";
|
|
|
|
repo = "wxWidgets";
|
|
|
|
rev = "489f6118256853cf5b299d595868641938566cdb";
|
|
|
|
hash = "sha256-xGL5I2+bPjmZGSTYe1L7VAmvLHbwd934o/cxg9baEvQ=";
|
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
});
|
2022-06-26 10:26:21 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "prusa-slicer";
|
2022-09-11 15:47:08 +00:00
|
|
|
version = "2.5.0";
|
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
|
|
|
|
nlopt
|
2022-09-11 15:47:08 +00:00
|
|
|
opencascade-occt
|
2020-04-24 23:36:52 +00:00
|
|
|
openvdb
|
2021-02-05 17:12:51 +00:00
|
|
|
pcre
|
2020-04-24 23:36:52 +00:00
|
|
|
tbb
|
2022-12-02 08:20:57 +00:00
|
|
|
wxGTK-prusa
|
2020-04-24 23:36:52 +00:00
|
|
|
xorg.libX11
|
2022-12-02 08:20:57 +00:00
|
|
|
] ++ lib.optionals withSystemd [
|
|
|
|
systemd
|
2020-04-24 23:36:52 +00:00
|
|
|
] ++ checkInputs;
|
|
|
|
|
2021-12-30 13:39:12 +00:00
|
|
|
patches = [
|
|
|
|
# Fix detection of TBB, see https://github.com/prusa3d/PrusaSlicer/issues/6355
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/prusa3d/PrusaSlicer/commit/76f4d6fa98bda633694b30a6e16d58665a634680.patch";
|
|
|
|
sha256 = "1r806ycp704ckwzgrw1940hh1l6fpz0k1ww3p37jdk6mygv53nv6";
|
|
|
|
})
|
2022-06-26 10:26:21 +00:00
|
|
|
# Fix compile error with boost 1.79. See https://github.com/prusa3d/PrusaSlicer/issues/8238
|
|
|
|
# Can be removed with the next version update
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/prusa3d/PrusaSlicer/commit/408e56f0390f20aaf793e0aa0c70c4d9544401d4.patch";
|
|
|
|
sha256 = "sha256-vzEPjLE3Yy5szawPn2Yp3i7MceWewpdnLUPVu9+H3W8=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/prusa3d/PrusaSlicer/commit/926ae0471800abd1e5335e251a5934570eb8f6ff.patch";
|
|
|
|
sha256 = "sha256-tAEgubeGGKFWY7r7p/6pmI2HXUGKi2TM1X5ILVZVT20=";
|
|
|
|
})
|
2021-12-30 13:39:12 +00:00
|
|
|
];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
doCheck = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
checkInputs = [ gtest ];
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
# Disable compiler warnings that clutter the build log.
|
|
|
|
# It seems to be a known issue for Eigen:
|
|
|
|
# http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1221
|
|
|
|
NIX_CFLAGS_COMPILE = "-Wno-ignored-attributes";
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
# Disable test_voronoi.cpp as the assembler hangs during build,
|
|
|
|
# likely due to commit e682dd84cff5d2420fcc0a40508557477f6cc9d3
|
|
|
|
# See issue #185808 for details.
|
|
|
|
sed -i 's|test_voronoi.cpp||g' tests/libslic3r/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
|
2022-12-02 08:20:57 +00:00
|
|
|
|
|
|
|
# Fix resources folder location on macOS
|
|
|
|
substituteInPlace src/PrusaSlicer.cpp \
|
|
|
|
--replace "#ifdef __APPLE__" "#if 0"
|
|
|
|
'' + lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
|
|
|
|
# Disable segfault tests
|
|
|
|
sed -i '/libslic3r/d' tests/CMakeLists.txt
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "prusa3d";
|
|
|
|
repo = "PrusaSlicer";
|
2022-09-11 15:47:08 +00:00
|
|
|
sha256 = "sha256-wLe+5TFdkgQ1mlGYgp8HBzugeONSne17dsBbwblILJ4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = "version_${version}";
|
|
|
|
};
|
|
|
|
|
|
|
|
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"
|
|
|
|
)
|
|
|
|
'';
|
|
|
|
|
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;
|
|
|
|
maintainers = with maintainers; [ moredread tweber ];
|
2023-01-11 07:51:40 +00:00
|
|
|
} // lib.optionalAttrs (stdenv.isDarwin) {
|
|
|
|
mainProgram = "PrusaSlicer";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|