add openmodelica

This commit is contained in:
2026-05-07 21:42:20 +09:00
parent d00f43a12e
commit 6ca3a89910
4 changed files with 130 additions and 16 deletions

View File

@@ -6,8 +6,7 @@
let
myRizin = pkgs.rizin.passthru.withPlugins
(plugins: [ plugins.jsdec plugins.rz-ghidra ]);
in
{
in {
imports = [
./hardware-configuration.nix
./services/virtual.nix
@@ -19,23 +18,21 @@ in
services.logind.lidSwitch = "suspend";
nixpkgs.config.allowUnfree = true;
boot.kernel.sysctl = {
"net.ipv4.ip_forward" = 1;
};
boot.kernel.sysctl = { "net.ipv4.ip_forward" = 1; };
#boot.loader.grub.device = "/dev/nvme1n1p1";
boot.loader = {
systemd-boot.enable = false;
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
grub = {
enable = true;
device = "nodev";
efiSupport = true;
useOSProber = true;
systemd-boot.enable = false;
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
grub = {
enable = true;
device = "nodev";
efiSupport = true;
useOSProber = true;
};
};
@@ -113,9 +110,20 @@ in
myRizin
libgit2
inputs.helix.packages."${pkgs.system}".helix
openmodelica
];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.settings.trusted-users = [ "root" "allen" ];
nix.settings = {
substituters =
[ "https://allen-nixpkgs.cachix.org" "https://cache.nixos.org" ];
trusted-public-keys = [
"allen-nixpkgs.cachix.org-1:GS5qDYVloEiC6oeJQNijR3hsMKPqDSGbYUz35qtbMpg="
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
];
};
environment.variables = {
LD_LIBRARY_PATH = lib.makeLibraryPath [

View File

@@ -16,6 +16,15 @@
specialArgs = { inherit inputs; };
modules = [
./configuration.nix
({ pkgs, ... }: {
# Define the overlay inline or in a separate file
nixpkgs.overlays = [
(final: prev: {
openmodelica = final.callPackage ./nixpkgs/openmodelica.nix { };
})
];
})
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
@@ -27,3 +36,4 @@
};
};
}

95
nixpkgs/openmodelica.nix Normal file
View File

@@ -0,0 +1,95 @@
{
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
];
}

View File

@@ -72,4 +72,5 @@ with pkgs; [
gptfdisk
openocd
probe-rs-tools
cachix
]