From 2df4affe417a3a822fc7688f925c766a9aa1d7bc Mon Sep 17 00:00:00 2001 From: Marco Rebhan Date: Mon, 2 Dec 2024 15:23:04 +0100 Subject: [PATCH] cplex: fix oplide --- .../science/math/cplex/default.nix | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/science/math/cplex/default.nix b/pkgs/applications/science/math/cplex/default.nix index 0a209560e9f5..d0fb7dfb73fd 100644 --- a/pkgs/applications/science/math/cplex/default.nix +++ b/pkgs/applications/science/math/cplex/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, autoPatchelfHook, makeDesktopItem, copyDesktopItems, makeWrapper, alsa-lib, openjdk, sqlite, unixODBC, gtk2, xorg, glibcLocales, releasePath ? null }: +{ lib, stdenv, autoPatchelfHook, makeDesktopItem, copyDesktopItems, makeWrapper, alsa-lib, glib, glib-networking, gsettings-desktop-schemas, gtk3, libsecret, openjdk, sqlite, unixODBC, gtk2, xorg, glibcLocales, releasePath ? null }: # To use this package, you need to download your own cplex installer from IBM # and override the releasePath attribute to point to the location of the file. @@ -27,7 +27,7 @@ stdenv.mkDerivation rec { releasePath; nativeBuildInputs = [ autoPatchelfHook copyDesktopItems makeWrapper openjdk ]; - buildInputs = [ alsa-lib gtk2 sqlite unixODBC xorg.libXtst glibcLocales ]; + buildInputs = [ alsa-lib gsettings-desktop-schemas gtk2 sqlite unixODBC xorg.libXtst glibcLocales ]; unpackPhase = "cp $src $name"; @@ -44,7 +44,9 @@ stdenv.mkDerivation rec { runHook postBuild ''; - installPhase = '' + installPhase = let + libraryPath = lib.makeLibraryPath [ stdenv.cc.cc glib gtk2 gtk3 libsecret xorg.libXtst ]; + in '' runHook preInstall mkdir -p $out/bin @@ -56,8 +58,19 @@ stdenv.mkDerivation rec { $out/cplex/bin/x86-64_linux/cplex \ $out/cpoptimizer/bin/x86-64_linux/cpoptimizer do - makeWrapper "$pgm" "$out/bin/$(basename "$pgm")" \ + makeWrapperArgs=( --set-default LOCALE_ARCHIVE ${glibcLocales}/lib/locale/locale-archive + ) + + if [[ "$pgm" = "$out/opl/oplide/oplide" ]]; then + makeWrapperArgs+=( + --prefix LD_LIBRARY_PATH : ${libraryPath} + --prefix GIO_EXTRA_MODULES : "${glib-networking}/lib/gio/modules" + --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" + ) + fi + + makeWrapper "$pgm" "$out/bin/$(basename "$pgm")" "''${makeWrapperArgs[@]}" done mkdir -p $out/share/pixmaps