nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 209 lines 4.7 kB view raw
1{ 2 stdenv, 3 lib, 4 binutils, 5 fetchFromGitHub, 6 fetchpatch, 7 cmake, 8 ninja, 9 pkg-config, 10 wrapGAppsHook3, 11 boost183, 12 cereal, 13 cgal_5, 14 curl, 15 dbus, 16 eigen, 17 expat, 18 ffmpeg, 19 gcc-unwrapped, 20 glew, 21 glfw, 22 glib, 23 glib-networking, 24 gmp, 25 gst_all_1, 26 gtest, 27 gtk3, 28 hicolor-icon-theme, 29 ilmbase, 30 libpng, 31 mpfr, 32 nlopt, 33 opencascade-occt_7_6, 34 openvdb, 35 opencv, 36 pcre, 37 systemd, 38 onetbb, 39 webkitgtk_4_1, 40 wxGTK31, 41 libx11, 42 withSystemd ? stdenv.hostPlatform.isLinux, 43}: 44let 45 wxGTK' = 46 (wxGTK31.override { 47 withCurl = true; 48 withPrivateFonts = true; 49 withWebKit = true; 50 }).overrideAttrs 51 (old: { 52 configureFlags = old.configureFlags ++ [ 53 # Disable noisy debug dialogs 54 "--enable-debug=no" 55 ]; 56 }); 57in 58stdenv.mkDerivation (finalAttrs: { 59 pname = "bambu-studio"; 60 version = "02.04.00.70"; 61 62 src = fetchFromGitHub { 63 owner = "bambulab"; 64 repo = "BambuStudio"; 65 tag = "v${finalAttrs.version}"; 66 hash = "sha256-BrH8gKbc0y76wbWrQxU+0xMJcYAm4Gi/xmECVf6pGkI="; 67 }; 68 69 nativeBuildInputs = [ 70 cmake 71 ninja 72 pkg-config 73 wrapGAppsHook3 74 ]; 75 76 buildInputs = [ 77 binutils 78 boost183 79 cereal 80 cgal_5 81 curl 82 dbus 83 eigen 84 expat 85 ffmpeg 86 gcc-unwrapped 87 glew 88 glfw 89 glib 90 glib-networking 91 gmp 92 gst_all_1.gstreamer 93 gst_all_1.gst-plugins-base 94 gst_all_1.gst-plugins-bad 95 gst_all_1.gst-plugins-good 96 gtk3 97 hicolor-icon-theme 98 ilmbase 99 libpng 100 mpfr 101 nlopt 102 opencascade-occt_7_6 103 openvdb 104 pcre 105 onetbb 106 webkitgtk_4_1 107 wxGTK' 108 libx11 109 opencv 110 ] 111 ++ lib.optionals withSystemd [ systemd ] 112 ++ finalAttrs.checkInputs; 113 114 patches = [ 115 # Fix for webkitgtk linking 116 ./patches/0001-not-for-upstream-CMakeLists-Link-against-webkit2gtk-.patch 117 # Fix an issue with 118 ./patches/dont-link-opencv-world-bambu.patch 119 # Don't link osmesa 120 ./patches/no-osmesa.patch 121 # Don't link cereal 122 ./patches/no-cereal.patch 123 # Cmake 4 support 124 ./patches/cmake.patch 125 # Fix build with gcc15 126 # https://github.com/bambulab/BambuStudio/pull/8555 127 (fetchpatch { 128 name = "bambu-studio-include-stdint-header.patch"; 129 url = "https://github.com/bambulab/BambuStudio/commit/434752bf643933f22348d78335abe7f60550e736.patch"; 130 hash = "sha256-vWqTM6IHL/gBncLk6gZHw+dFe0sdVuPdUqYeVJUbTis="; 131 }) 132 ]; 133 134 doCheck = true; 135 checkInputs = [ gtest ]; 136 137 separateDebugInfo = true; 138 139 # The build system uses custom logic - defined in 140 # cmake/modules/FindNLopt.cmake in the package source - for finding the nlopt 141 # library, which doesn't pick up the package in the nix store. We 142 # additionally need to set the path via the NLOPT environment variable. 143 NLOPT = nlopt; 144 145 NIX_CFLAGS_COMPILE = toString [ 146 "-DBOOST_TIMER_ENABLE_DEPRECATED" 147 # Disable compiler warnings that clutter the build log. 148 # It seems to be a known issue for Eigen: 149 # http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1221 150 "-Wno-ignored-attributes" 151 "-I${opencv}/include/opencv4" 152 ]; 153 154 # prusa-slicer uses dlopen on `libudev.so` at runtime 155 NIX_LDFLAGS = lib.optionalString withSystemd "-ludev" + " -L${opencv}/lib -lopencv_imgcodecs"; 156 157 # TODO: macOS 158 prePatch = '' 159 # Since version 2.5.0 of nlopt we need to link to libnlopt, as libnlopt_cxx 160 # now seems to be integrated into the main lib. 161 sed -i 's|nlopt_cxx|nlopt|g' cmake/modules/FindNLopt.cmake 162 ''; 163 164 cmakeFlags = [ 165 "-DSLIC3R_STATIC=0" 166 "-DSLIC3R_FHS=1" 167 "-DSLIC3R_GTK=3" 168 169 # Skips installing ffmpeg, since we BYO. 170 "-DFLATPAK=1" 171 172 # BambuStudio-specific 173 "-DBBL_RELEASE_TO_PUBLIC=1" 174 "-DBBL_INTERNAL_TESTING=0" 175 "-DDEP_WX_GTK3=ON" 176 "-DSLIC3R_BUILD_TESTS=0" 177 "-DCMAKE_CXX_FLAGS=-DBOOST_LOG_DYN_LINK" 178 ]; 179 180 preFixup = '' 181 gappsWrapperArgs+=( 182 --prefix LD_LIBRARY_PATH : "$out/lib" 183 184 # Fixes intermittent crash 185 # The upstream setup links in glew statically 186 --prefix LD_PRELOAD : "${glew.out}/lib/libGLEW.so" 187 ) 188 ''; 189 190 # needed to prevent collisions between the LICENSE.txt files of 191 # bambu-studio and orca-slicer. 192 postInstall = '' 193 mv $out/LICENSE.txt $out/share/BambuStudio/LICENSE.txt 194 mv $out/README.md $out/share/BambuStudio/README.md 195 ''; 196 197 meta = { 198 description = "PC Software for BambuLab's 3D printers"; 199 homepage = "https://github.com/bambulab/BambuStudio"; 200 changelog = "https://github.com/bambulab/BambuStudio/releases/tag/v${finalAttrs.version}"; 201 license = lib.licenses.agpl3Plus; 202 maintainers = with lib.maintainers; [ 203 zhaofengli 204 dsluijk 205 ]; 206 mainProgram = "bambu-studio"; 207 platforms = lib.platforms.linux; 208 }; 209})