Files
nixos-config/nixpkgs/openmodelica.nix
2026-05-07 17:40:59 +09:00

95 lines
2.0 KiB
Nix

{
pkgs ? import <nixpkgs> { },
}:
let
desktopItem = pkgs.makeDesktopItem {
name = "openmodelica";
desktopName = "OpenModelica Connection Editor";
exec = "OMEdit";
icon = "openmodelica";
categories = [
"Development"
"Science"
"Education"
];
comment = "Modelica-based modeling and simulation environment";
};
in
with 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
];
}