nixpkgs/pkgs/applications/graphics/freecad/default.nix
Juraj Hercek 269b500073 freecad: fix crash when selecting color of a solid
FreeCAD crashes when user wants to select color of a solid with
following console message (long lines wrapped):

    $ nix run nixpkgs#freecad
    FreeCAD 0.20, Libs: 0.20RUnknown
    © Juergen Riegel, Werner Mayer, Yorik van Havre and others 2001-2022
    FreeCAD is free and open-source software licensed under the terms of
    LGPL2+ license.
    FreeCAD wouldn't be possible without FreeCAD community.
      #####                 ####  ###   ####
      #                    #      # #   #   #
      #     ##  #### ####  #     #   #  #   #
      ####  # # #  # #  #  #     #####  #   #
      #     #   #### ####  #    #     # #   #
      #     #   #    #     #    #     # #   #  ##  ##  ##
      #     #   #### ####   ### #     # ####   ##  ##  ##

    (freecad:19737): GLib-GIO-ERROR **: 14:33:02.511: Settings schema
    'org.gtk.Settings.ColorChooser' is not installed
    fish: Job 1, 'nix run nixpkgs#freecad' terminated by signal SIGTRAP
    (Trace or breakpoint trap)

This patch adds hooks for GApps to relevant places in order to make
FreeCAD finding the Color Chooser dialog schema effectively preventing
crash from happening.
2022-07-02 14:45:37 +02:00

170 lines
3.6 KiB
Nix

{ lib
, stdenv
, mkDerivation
, fetchFromGitHub
, fetchpatch
, cmake
, ninja
, GitPython
, boost
, coin3d
, eigen
, gfortran
, gts
, hdf5
, libGLU
, libXmu
, libf2c
, libredwg
, libspnav
, matplotlib
, medfile
, mpi
, ode
, opencascade-occt
, pivy
, pkg-config
, ply
, pycollada
, pyside2
, pyside2-tools
, python
, pyyaml
, qtbase
, qttools
, qtwebengine
, qtx11extras
, qtxmlpatterns
, scipy
, shiboken2
, soqt
, spaceNavSupport ? stdenv.isLinux
, swig
, vtk
, wrapQtAppsHook
, wrapGAppsHook
, xercesc
, zlib
}:
mkDerivation rec {
pname = "freecad";
version = "0.20";
src = fetchFromGitHub {
owner = "FreeCAD";
repo = "FreeCAD";
rev = version;
hash = "sha256-Em4XVxDfvVG1Kf7q+6uHNA/VcMGLKMTv5TCh2XF/BtQ=";
};
nativeBuildInputs = [
cmake
ninja
pkg-config
pyside2-tools
gfortran
wrapQtAppsHook
wrapGAppsHook
];
buildInputs = [
GitPython # for addon manager
boost
coin3d
eigen
gts
hdf5
libGLU
libXmu
libf2c
matplotlib
medfile
mpi
ode
opencascade-occt
pivy
ply # for openSCAD file support
pycollada
pyside2
pyside2-tools
python
pyyaml # (at least for) PyrateWorkbench
qtbase
qttools
qtwebengine
qtxmlpatterns
scipy
shiboken2
soqt
swig
vtk
xercesc
zlib
] ++ lib.optionals spaceNavSupport [
libspnav
qtx11extras
];
cmakeFlags = [
"-Wno-dev" # turns off warnings which otherwise makes it hard to see what is going on
"-DBUILD_FLAT_MESH:BOOL=ON"
"-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"
];
# This should work on both x86_64, and i686 linux
preBuild = ''
export NIX_LDFLAGS="-L${gfortran.cc}/lib64 -L${gfortran.cc}/lib $NIX_LDFLAGS";
'';
# Their main() removes PYTHONPATH=, and we rely on it.
preConfigure = ''
sed '/putenv("PYTHONPATH/d' -i src/Main/MainGui.cpp
qtWrapperArgs+=(--prefix PYTHONPATH : "$PYTHONPATH")
'';
qtWrapperArgs = [
"--set COIN_GL_NO_CURRENT_CONTEXT_CHECK 1"
"--prefix PATH : ${libredwg}/bin"
];
postFixup = ''
mv $out/share/doc $out
ln -s $out/bin/FreeCAD $out/bin/freecad
ln -s $out/bin/FreeCADCmd $out/bin/freecadcmd
'';
meta = with lib; {
homepage = "https://www.freecadweb.org/";
description = "General purpose Open Source 3D CAD/MCAD/CAx/CAE/PLM modeler";
longDescription = ''
FreeCAD is an open-source parametric 3D modeler made primarily to design
real-life objects of any size. Parametric modeling allows you to easily
modify your design by going back into your model history and changing its
parameters.
FreeCAD allows you to sketch geometry constrained 2D shapes and use them
as a base to build other objects. It contains many components to adjust
dimensions or extract design details from 3D models to create high quality
production ready drawings.
FreeCAD is designed to fit a wide range of uses including product design,
mechanical engineering and architecture. Whether you are a hobbyist, a
programmer, an experienced CAD user, a student or a teacher, you will feel
right at home with FreeCAD.
'';
license = licenses.lgpl2Plus;
maintainers = with maintainers; [ viric gebner AndersonTorres ];
platforms = platforms.linux;
};
}