bambu-studio: make this package functional/usable again (various fixes) (#522161)

This commit is contained in:
Martin Weinelt
2026-05-27 14:12:40 +00:00
committed by GitHub
+43 -16
View File
@@ -1,13 +1,13 @@
{
stdenv,
lib,
binutils,
fetchFromGitHub,
cmake,
ninja,
pkg-config,
wrapGAppsHook3,
boost183,
cacert,
cereal,
cgal_5,
curl,
@@ -15,7 +15,6 @@
eigen,
expat,
ffmpeg,
gcc-unwrapped,
glew,
glfw,
glib,
@@ -26,19 +25,24 @@
gtk3,
hicolor-icon-theme,
libpng,
libsecret,
makeFontsConf,
mpfr,
nanum,
nlopt,
opencascade-occt_7_6,
openvdb,
openexr,
opencv,
pcre,
systemd,
onetbb,
webkitgtk_4_1,
wxwidgets_3_1,
libx11,
withSystemd ? stdenv.hostPlatform.isLinux,
# 3D viewport blank on NVIDIA proprietary GL; routes through Mesa + zink.
# https://github.com/NixOS/nixpkgs/issues/498311
withNvidiaGLWorkaround ? false,
}:
let
wxGTK' =
@@ -48,11 +52,17 @@ let
withWebKit = true;
}).overrideAttrs
(old: {
buildInputs = old.buildInputs ++ [ libsecret ];
configureFlags = old.configureFlags ++ [
# Disable noisy debug dialogs
"--enable-debug=no"
"--enable-secretstore"
];
});
fontsConf = makeFontsConf { fontDirectories = [ nanum ]; };
caBundle = "${cacert}/etc/ssl/certs/ca-bundle.crt";
in
stdenv.mkDerivation (finalAttrs: {
pname = "bambu-studio";
@@ -73,7 +83,6 @@ stdenv.mkDerivation (finalAttrs: {
];
buildInputs = [
binutils
boost183
cereal
cgal_5
@@ -82,7 +91,6 @@ stdenv.mkDerivation (finalAttrs: {
eigen
expat
ffmpeg
gcc-unwrapped
glew
glfw
glib
@@ -95,12 +103,12 @@ stdenv.mkDerivation (finalAttrs: {
gtk3
hicolor-icon-theme
libpng
libsecret
mpfr
nlopt
opencascade-occt_7_6
openexr
openvdb
pcre
onetbb
webkitgtk_4_1
wxGTK'
@@ -156,19 +164,19 @@ stdenv.mkDerivation (finalAttrs: {
'';
cmakeFlags = [
"-DSLIC3R_STATIC=0"
"-DSLIC3R_FHS=1"
"-DSLIC3R_GTK=3"
(lib.cmakeBool "SLIC3R_STATIC" false)
(lib.cmakeBool "SLIC3R_FHS" true)
(lib.cmakeFeature "SLIC3R_GTK" "3")
# Skips installing ffmpeg, since we BYO.
"-DFLATPAK=1"
(lib.cmakeBool "FLATPAK" true)
# BambuStudio-specific
"-DBBL_RELEASE_TO_PUBLIC=1"
"-DBBL_INTERNAL_TESTING=0"
"-DDEP_WX_GTK3=ON"
"-DSLIC3R_BUILD_TESTS=0"
"-DCMAKE_CXX_FLAGS=-DBOOST_LOG_DYN_LINK"
# Substituted into `#define BBL_x @value@`; must be integer literals.
(lib.cmakeFeature "BBL_RELEASE_TO_PUBLIC" "1")
(lib.cmakeFeature "BBL_INTERNAL_TESTING" "0")
(lib.cmakeBool "DEP_WX_GTK3" true)
(lib.cmakeBool "SLIC3R_BUILD_TESTS" false)
(lib.cmakeFeature "CMAKE_CXX_FLAGS" "-DBOOST_LOG_DYN_LINK")
];
preFixup = ''
@@ -178,6 +186,25 @@ stdenv.mkDerivation (finalAttrs: {
# Fixes intermittent crash
# The upstream setup links in glew statically
--prefix LD_PRELOAD : "${glew.out}/lib/libGLEW.so"
# plugin libcurl + main HTTPS need explicit CA bundle.
# https://github.com/NixOS/nixpkgs/issues/498307
--set-default SSL_CERT_FILE ${caBundle}
--set-default CURL_CA_BUNDLE ${caBundle}
# WebKit OAuth callback fails with DMA-BUF compositing.
# https://github.com/NixOS/nixpkgs/issues/498307
--set WEBKIT_DISABLE_COMPOSITING_MODE 1
--set WEBKIT_DISABLE_DMABUF_RENDERER 1
--set FONTCONFIG_FILE "${fontsConf}"
${lib.optionalString withNvidiaGLWorkaround ''
--set __GLX_VENDOR_LIBRARY_NAME mesa
--set __EGL_VENDOR_LIBRARY_FILENAMES /run/opengl-driver/share/glvnd/egl_vendor.d/50_mesa.json
--set MESA_LOADER_DRIVER_OVERRIDE zink
--set GALLIUM_DRIVER zink
''}
)
'';