mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-10-20 20:19:39 +03:00
15b8478211
This commit fixes #26650 The main problem was that the iKVM related libraries are always loaded from the current working directory. The bundled wrapper script makes sure to CD to the package root folder. This is a no-go in nix as the application writes its settings in the current working directory and the store is read-only. Workaround: create a directory in the users home, where the required binaries are symlinked and is writable for the current user. There was an additional issue that for some BMCs IPMIView relies on the bundled `stunnel` binary to wrap the iKVM traffic in a TLS tunnel. Therefore it has to be patched to make it executable and the `killall` command is needed on the PATH because it is used to terminate the `stunnel` process upon exit.
62 lines
2.2 KiB
Nix
62 lines
2.2 KiB
Nix
{ stdenv
|
|
, fetchurl
|
|
, makeWrapper
|
|
, patchelf
|
|
, fontconfig
|
|
, freetype
|
|
, gcc
|
|
, gcc-unwrapped
|
|
, iputils
|
|
, psmisc
|
|
, xorg }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "IPMIView";
|
|
version = "2.16.0";
|
|
buildVersion = "190815";
|
|
|
|
src = fetchurl {
|
|
url = "https://www.supermicro.com/wftp/utility/IPMIView/Linux/IPMIView_${version}_build.${buildVersion}_bundleJRE_Linux_x64.tar.gz";
|
|
sha256 = "0qw9zfnj0cyvab7ndamlw2y0gpczjhh1jkz8340kl42r2xmhkvpl";
|
|
};
|
|
|
|
nativeBuildInputs = [ patchelf makeWrapper ];
|
|
buildPhase = with xorg;
|
|
let
|
|
stunnelBinary = if stdenv.hostPlatform.system == "x86_64-linux" then "linux/stunnel64"
|
|
else if stdenv.hostPlatform.system == "i686-linux" then "linux/stunnel32"
|
|
else throw "IPMIView is not supported on this platform";
|
|
in
|
|
''
|
|
patchelf --set-rpath "${stdenv.lib.makeLibraryPath [ libX11 libXext libXrender libXtst libXi ]}" ./jre/lib/amd64/libawt_xawt.so
|
|
patchelf --set-rpath "${stdenv.lib.makeLibraryPath [ freetype ]}" ./jre/lib/amd64/libfontmanager.so
|
|
patchelf --set-rpath "${gcc-unwrapped.lib}/lib" ./libiKVM64.so
|
|
patchelf --set-rpath "${gcc.cc}/lib:$out/jre/lib/amd64/jli" --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" ./jre/bin/java
|
|
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" ./BMCSecurity/${stunnelBinary}
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
cp -R . $out/
|
|
|
|
# LD_LIBRARY_PATH: fontconfig is used from java code
|
|
# PATH: iputils is used for ping, and psmisc is for killall
|
|
# WORK_DIR: unfortunately the ikvm related binaries are loaded from
|
|
# and user configuration is written to files in the CWD
|
|
makeWrapper $out/jre/bin/java $out/bin/IPMIView \
|
|
--set LD_LIBRARY_PATH "${stdenv.lib.makeLibraryPath [ fontconfig ]}" \
|
|
--prefix PATH : "$out/jre/bin:${iputils}/bin:${psmisc}/bin" \
|
|
--add-flags "-jar $out/IPMIView20.jar" \
|
|
--run 'WORK_DIR=''${XDG_DATA_HOME:-~/.local/share}/ipmiview
|
|
mkdir -p $WORK_DIR
|
|
ln -snf '$out'/iKVM.jar '$out'/libiKVM* '$out'/libSharedLibrary* $WORK_DIR
|
|
cd $WORK_DIR'
|
|
'';
|
|
|
|
meta = with stdenv.lib; {
|
|
license = licenses.unfree;
|
|
maintainers = with maintainers; [ vlaci ];
|
|
platforms = [ "x86_64-linux" "i686-linux" ];
|
|
};
|
|
}
|