From 3dc41d5504f84df3d96f1aab5c9b09297b2f3197 Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Sat, 14 Jun 2025 17:21:55 +0200 Subject: [PATCH 1/3] freecad: remove qt5 version Qt5 support is was officially reduced by qt [1]. FreeCAD supports both Qt5 and Qt6. While their github build still uses Qt5, the official flatpak uses Qt6 [2]. Additionally, keeping Qt5 support requires pinning python to 3.12 or older, as shiboken2 would break. Currently, this breakage is imminent: #412204 unpinned python, with the next staging-next merge updating py to 3.13. [1] https://www.qt.io/blog/extended-security-maintenance-for-qt-5.15-begins-may-2025 [2] https://github.com/flathub/org.freecad.FreeCAD/blob/ad843adc0a29a2c78bdd60624376aab61445ed63/org.freecad.FreeCAD.yaml#L62 --- pkgs/by-name/fr/freecad/package.nix | 103 ++++++++-------------------- pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 4 -- 3 files changed, 31 insertions(+), 77 deletions(-) diff --git a/pkgs/by-name/fr/freecad/package.nix b/pkgs/by-name/fr/freecad/package.nix index 42227a525e01d..0b1ae7617ae78 100644 --- a/pkgs/by-name/fr/freecad/package.nix +++ b/pkgs/by-name/fr/freecad/package.nix @@ -13,14 +13,12 @@ hdf5, libGLU, libredwg, - libsForQt5, libspnav, libXmu, medfile, mpi, ninja, ode, - opencascade-occt_7_6, opencascade-occt, pkg-config, python3Packages, @@ -34,8 +32,6 @@ yaml-cpp, zlib, withWayland ? false, - qtVersion ? 5, - qt5, qt6, nix-update-script, }: @@ -51,13 +47,10 @@ let py-slvs pybind11 pycollada - pyside2 - pyside2-tools pyside6 python pyyaml scipy - shiboken2 shiboken6 ; freecad-utils = callPackage ./freecad-utils.nix { }; @@ -75,21 +68,16 @@ freecad-utils.makeCustomizable ( fetchSubmodules = true; }; - nativeBuildInputs = - [ - cmake - ninja - pkg-config - gfortran - swig - doxygen - wrapGAppsHook3 - ] - ++ lib.optionals (qtVersion == 5) [ - pyside2-tools - qt5.wrapQtAppsHook - ] - ++ lib.optionals (qtVersion == 6) [ qt6.wrapQtAppsHook ]; + nativeBuildInputs = [ + cmake + ninja + pkg-config + gfortran + swig + doxygen + wrapGAppsHook3 + qt6.wrapQtAppsHook + ]; buildInputs = [ @@ -119,20 +107,6 @@ freecad-utils.makeCustomizable ( xercesc yaml-cpp zlib - ] - ++ lib.optionals (qtVersion == 5) [ - libsForQt5.soqt - opencascade-occt_7_6 - pyside2 - pyside2-tools - shiboken2 - qt5.qtbase - qt5.qttools - qt5.qtwayland - qt5.qtwebengine - qt5.qtxmlpatterns - ] - ++ lib.optionals (qtVersion == 6) [ opencascade-occt pyside6 shiboken6 @@ -145,9 +119,7 @@ freecad-utils.makeCustomizable ( ++ lib.optionals ifcSupport [ ifcopenshell ] - ++ lib.optionals spaceNavSupport ( - [ libspnav ] ++ lib.optionals (qtVersion == 5) [ libsForQt5.qtx11extras ] - ); + ++ lib.optionals spaceNavSupport [ libspnav ]; patches = [ ./0001-NIXOS-don-t-ignore-PYTHONPATH.patch @@ -158,40 +130,25 @@ freecad-utils.makeCustomizable ( }) ]; - cmakeFlags = - [ - "-Wno-dev" # turns off warnings which otherwise makes it hard to see what is going on - "-DBUILD_FLAT_MESH:BOOL=ON" - "-DBUILD_DRAWING=ON" - "-DBUILD_FLAT_MESH:BOOL=ON" - "-DINSTALL_TO_SITEPACKAGES=OFF" - "-DFREECAD_USE_PYBIND11=ON" - ] - ++ lib.optionals (qtVersion == 5) [ - "-DBUILD_QT5=ON" - "-DSHIBOKEN_INCLUDE_DIR=${shiboken2}/include" - "-DSHIBOKEN_LIBRARY=Shiboken2::libshiboken" - ( - "-DPYSIDE_INCLUDE_DIR=${pyside2}/include" - + ";${pyside2}/include/PySide2/QtCore" - + ";${pyside2}/include/PySide2/QtWidgets" - + ";${pyside2}/include/PySide2/QtGui" - ) - "-DPYSIDE_LIBRARY=PySide2::pyside2" - ] - ++ lib.optionals (qtVersion == 6) [ - "-DBUILD_QT5=OFF" - "-DBUILD_QT6=ON" - "-DSHIBOKEN_INCLUDE_DIR=${shiboken6}/include" - "-DSHIBOKEN_LIBRARY=Shiboken6::libshiboken" - ( - "-DPYSIDE_INCLUDE_DIR=${pyside6}/include" - + ";${pyside6}/include/PySide6/QtCore" - + ";${pyside6}/include/PySide6/QtWidgets" - + ";${pyside6}/include/PySide6/QtGui" - ) - "-DPYSIDE_LIBRARY=PySide6::pyside6" - ]; + cmakeFlags = [ + "-Wno-dev" # turns off warnings which otherwise makes it hard to see what is going on + "-DBUILD_FLAT_MESH:BOOL=ON" + "-DBUILD_DRAWING=ON" + "-DBUILD_FLAT_MESH:BOOL=ON" + "-DINSTALL_TO_SITEPACKAGES=OFF" + "-DFREECAD_USE_PYBIND11=ON" + "-DBUILD_QT5=OFF" + "-DBUILD_QT6=ON" + "-DSHIBOKEN_INCLUDE_DIR=${shiboken6}/include" + "-DSHIBOKEN_LIBRARY=Shiboken6::libshiboken" + ( + "-DPYSIDE_INCLUDE_DIR=${pyside6}/include" + + ";${pyside6}/include/PySide6/QtCore" + + ";${pyside6}/include/PySide6/QtWidgets" + + ";${pyside6}/include/PySide6/QtGui" + ) + "-DPYSIDE_LIBRARY=PySide6::pyside6" + ]; # This should work on both x86_64, and i686 linux preBuild = '' diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 211293f8958b6..389bc727fe078 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -696,6 +696,7 @@ mapAliases { fractal-next = fractal; # added 2023-11-25 framework-system-tools = framework-tool; # added 2023-12-09 francis = kdePackages.francis; # added 2024-07-13 + freecad-qt6 = freecad; # added 2025-06-14 freerdp3 = freerdp; # added 2025-03-25 freerdpUnstable = freerdp; # added 2025-03-25 frostwire = throw "frostwire was removed, as it was broken due to reproducibility issues, use `frostwire-bin` package instead."; # added 2024-05-17 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 11f7db61d8647..84afe12e8175c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14955,10 +14955,6 @@ with pkgs; flightgear = libsForQt5.callPackage ../games/flightgear { }; freecad-wayland = freecad.override { withWayland = true; }; - freecad-qt6 = freecad.override { - withWayland = true; - qtVersion = 6; - }; freeciv = callPackage ../games/freeciv { sdl2Client = false; From 34a33ec1bf0e19457ac3f14c9e3932f840ab0093 Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Sat, 14 Jun 2025 18:54:43 +0200 Subject: [PATCH 2/3] freecad: remove explicit wayland version Qt will figure out which platform plugin to use. Many of our packages already explicitly unset `QT_QPA_PLATFORM`, it makes little sense to force it here. --- pkgs/by-name/fr/freecad/package.nix | 3 +-- pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pkgs/by-name/fr/freecad/package.nix b/pkgs/by-name/fr/freecad/package.nix index 0b1ae7617ae78..613d7d3c709bf 100644 --- a/pkgs/by-name/fr/freecad/package.nix +++ b/pkgs/by-name/fr/freecad/package.nix @@ -31,7 +31,6 @@ xercesc, yaml-cpp, zlib, - withWayland ? false, qt6, nix-update-script, }: @@ -162,7 +161,7 @@ freecad-utils.makeCustomizable ( qtWrapperArgs = [ "--set COIN_GL_NO_CURRENT_CONTEXT_CHECK 1" "--prefix PATH : ${libredwg}/bin" - ] ++ lib.optionals (!withWayland) [ "--set QT_QPA_PLATFORM xcb" ]; + ]; postFixup = '' mv $out/share/doc $out diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 389bc727fe078..6df3b84edaf5c 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -697,6 +697,7 @@ mapAliases { framework-system-tools = framework-tool; # added 2023-12-09 francis = kdePackages.francis; # added 2024-07-13 freecad-qt6 = freecad; # added 2025-06-14 + freecad-wayland = freecad; # added 2025-06-14 freerdp3 = freerdp; # added 2025-03-25 freerdpUnstable = freerdp; # added 2025-03-25 frostwire = throw "frostwire was removed, as it was broken due to reproducibility issues, use `frostwire-bin` package instead."; # added 2024-05-17 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 84afe12e8175c..bcc92c35afd5a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14954,8 +14954,6 @@ with pkgs; flightgear = libsForQt5.callPackage ../games/flightgear { }; - freecad-wayland = freecad.override { withWayland = true; }; - freeciv = callPackage ../games/freeciv { sdl2Client = false; gtkClient = true; From d72cbf576f98d6756d08565166f9803ba28f0d59 Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Sat, 14 Jun 2025 20:53:06 +0200 Subject: [PATCH 3/3] freecad: avoid duplicate wrapping --- pkgs/by-name/fr/freecad/package.nix | 73 ++++++++++++----------------- 1 file changed, 31 insertions(+), 42 deletions(-) diff --git a/pkgs/by-name/fr/freecad/package.nix b/pkgs/by-name/fr/freecad/package.nix index 613d7d3c709bf..ff7cb2b9ac7b9 100644 --- a/pkgs/by-name/fr/freecad/package.nix +++ b/pkgs/by-name/fr/freecad/package.nix @@ -35,23 +35,28 @@ nix-update-script, }: let - inherit (python3Packages) - boost - gitpython - ifcopenshell - matplotlib - opencamlib - pivy - ply - py-slvs - pybind11 - pycollada - pyside6 - python - pyyaml - scipy - shiboken6 - ; + pythonDeps = + with python3Packages; + [ + boost + gitpython # for addon manager + matplotlib + opencamlib + pivy + ply # for openSCAD file support + py-slvs + pybind11 + pycollada + pyside6 + python + pyyaml # (at least for) PyrateWorkbench + scipy + shiboken6 + ] + ++ lib.optionals ifcSupport [ + ifcopenshell + ]; + freecad-utils = callPackage ./freecad-utils.nix { }; in freecad-utils.makeCustomizable ( @@ -80,44 +85,28 @@ freecad-utils.makeCustomizable ( buildInputs = [ - boost coin3d eigen fmt - gitpython # for addon manager gts hdf5 libGLU libXmu - matplotlib medfile mpi ode - opencamlib - pivy - ply # for openSCAD file support - py-slvs - pybind11 - pycollada - python - pyyaml # (at least for) PyrateWorkbench - scipy vtk xercesc yaml-cpp zlib opencascade-occt - pyside6 - shiboken6 qt6.qtbase qt6.qtsvg qt6.qttools qt6.qtwayland qt6.qtwebengine ] - ++ lib.optionals ifcSupport [ - ifcopenshell - ] + ++ pythonDeps ++ lib.optionals spaceNavSupport [ libspnav ]; patches = [ @@ -138,13 +127,13 @@ freecad-utils.makeCustomizable ( "-DFREECAD_USE_PYBIND11=ON" "-DBUILD_QT5=OFF" "-DBUILD_QT6=ON" - "-DSHIBOKEN_INCLUDE_DIR=${shiboken6}/include" + "-DSHIBOKEN_INCLUDE_DIR=${python3Packages.shiboken6}/include" "-DSHIBOKEN_LIBRARY=Shiboken6::libshiboken" ( - "-DPYSIDE_INCLUDE_DIR=${pyside6}/include" - + ";${pyside6}/include/PySide6/QtCore" - + ";${pyside6}/include/PySide6/QtWidgets" - + ";${pyside6}/include/PySide6/QtGui" + "-DPYSIDE_INCLUDE_DIR=${python3Packages.pyside6}/include" + + ";${python3Packages.pyside6}/include/PySide6/QtCore" + + ";${python3Packages.pyside6}/include/PySide6/QtWidgets" + + ";${python3Packages.pyside6}/include/PySide6/QtGui" ) "-DPYSIDE_LIBRARY=PySide6::pyside6" ]; @@ -154,13 +143,13 @@ freecad-utils.makeCustomizable ( export NIX_LDFLAGS="-L${gfortran.cc.lib}/lib64 -L${gfortran.cc.lib}/lib $NIX_LDFLAGS"; ''; - preConfigure = '' - qtWrapperArgs+=(--prefix PYTHONPATH : "$PYTHONPATH") - ''; + dontWrapGApps = true; qtWrapperArgs = [ "--set COIN_GL_NO_CURRENT_CONTEXT_CHECK 1" "--prefix PATH : ${libredwg}/bin" + "--prefix PYTHONPATH : ${python3Packages.makePythonPath pythonDeps}" + "\${gappsWrapperArgs[@]}" ]; postFixup = ''