{ pkgs ? import { }, }: let desktopItem = pkgs.makeDesktopItem { name = "openmodelica"; desktopName = "OpenModelica Connection Editor"; exec = "env QT_QPA_PLATFORM=xcb QT_QPA_PLATFORMTHEME=qt6ct OMEdit"; icon = "openmodelica"; categories = [ "Development" "Science" "Education" ]; comment = "Modelica-based modeling and simulation environment"; }; openmodelica-core = pkgs.stdenv.mkDerivation { name = "openmodelica-bin"; version = "custom"; src = pkgs.fetchgit { url = "https://github.com/OpenModelica/OpenModelica.git"; rev = "959f964dadf1b928f03e3c2f74b8f816f95df1ef"; fetchSubmodules = true; sha256 = "sha256-3rFIrg7+t/eX2mq21v9AcYhV3Adloa8Sae9uRGtbyrY="; }; nativeBuildInputs = with pkgs; [ cmake gfortran pkg-config qt6.wrapQtAppsHook autoPatchelfHook flex autoconf automake libtool ninja ]; configurePhase = '' cmake -S . -B build_cmake -GNinja -DOM_USE_CCACHE=OFF -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_PREFIX=$out ''; buildPhase = '' cmake --build build_cmake --parallel $NIX_BUILD_CORES --target install ''; installPhase = '' cmake --install build_cmake --prefix $out runHook postInstall ''; postInstall = '' if [ -d "$out/lib64" ]; then mkdir -p $out/lib cp -rn $out/lib64/* $out/lib/ rm -rf $out/lib64 fi mkdir -p $out/share/applications cp ${desktopItem}/share/applications/* $out/share/applications/ # If you have an icon file in your source, install it too # mkdir -p $out/share/icons/hicolor/scalable/apps # cp $src/path/to/icon.svg $out/share/icons/hicolor/scalable/apps/openmodelica.svg ''; buildInputs = with pkgs; [ # Compilers and Build Tools # Dependencies boost hwloc jdk lapack blas hdf5 expat omniorb curl ncurses readline openscenegraph qt6.qt5compat qt6.qtbase qt6.qtwebengine qt6.qtdeclarative qt6.qttools lapack-reference ]; }; in pkgs.symlinkJoin { name = "openmodelica"; paths = [ openmodelica-core ]; }