From 96b2c4c3951d7c7d89148cb13f4a6bfcf304cdd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Wed, 25 Sep 2019 08:51:46 +0200 Subject: [PATCH 1/4] IPMIView: fix indentation --- pkgs/applications/misc/ipmiview/default.nix | 42 ++++++++++----------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/pkgs/applications/misc/ipmiview/default.nix b/pkgs/applications/misc/ipmiview/default.nix index 64e0f0d325b..991a706cc6a 100644 --- a/pkgs/applications/misc/ipmiview/default.nix +++ b/pkgs/applications/misc/ipmiview/default.nix @@ -1,33 +1,33 @@ { stdenv, fetchurl, patchelf, makeWrapper, xorg, gcc, gcc-unwrapped }: stdenv.mkDerivation rec { - pname = "IPMIView"; - version = "2.14.0"; - buildVersion = "180213"; + pname = "IPMIView"; + version = "2.14.0"; + buildVersion = "180213"; - src = fetchurl { + src = fetchurl { url = "ftp://ftp.supermicro.com/utility/IPMIView/Linux/IPMIView_${version}_build.${buildVersion}_bundleJRE_Linux_x64.tar.gz"; sha256 = "1wp22wm7smlsb25x0cck4p660cycfczxj381930crd1qrf68mw4h"; }; - nativeBuildInputs = [ patchelf makeWrapper ]; + nativeBuildInputs = [ patchelf makeWrapper ]; - buildPhase = with xorg; '' - patchelf --set-rpath "${stdenv.lib.makeLibraryPath [ libX11 libXext libXrender libXtst libXi ]}" ./jre/lib/amd64/xawt/libmawt.so - patchelf --set-rpath "${gcc-unwrapped.lib}/lib" ./libiKVM64.so - patchelf --set-rpath "${stdenv.lib.makeLibraryPath [ libXcursor libX11 libXext libXrender libXtst libXi ]}" --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" ./jre/bin/javaws - patchelf --set-rpath "${gcc.cc}/lib:$out/jre/lib/amd64/jli" --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" ./jre/bin/java - ''; + buildPhase = with xorg; '' + patchelf --set-rpath "${stdenv.lib.makeLibraryPath [ libX11 libXext libXrender libXtst libXi ]}" ./jre/lib/amd64/xawt/libmawt.so + patchelf --set-rpath "${gcc-unwrapped.lib}/lib" ./libiKVM64.so + patchelf --set-rpath "${stdenv.lib.makeLibraryPath [ libXcursor libX11 libXext libXrender libXtst libXi ]}" --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" ./jre/bin/javaws + patchelf --set-rpath "${gcc.cc}/lib:$out/jre/lib/amd64/jli" --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" ./jre/bin/java + ''; - installPhase = '' - mkdir -p $out/bin - cp -R . $out/ - makeWrapper $out/jre/bin/java $out/bin/IPMIView \ - --prefix PATH : "$out/jre/bin" \ - --add-flags "-jar $out/IPMIView20.jar" - ''; + installPhase = '' + mkdir -p $out/bin + cp -R . $out/ + makeWrapper $out/jre/bin/java $out/bin/IPMIView \ + --prefix PATH : "$out/jre/bin" \ + --add-flags "-jar $out/IPMIView20.jar" + ''; - meta = with stdenv.lib; { + meta = with stdenv.lib; { license = licenses.unfree; - }; - } + }; +} From 13cd9e1bf3fd12458d201f7908898b3ee7c5bb20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Wed, 25 Sep 2019 09:07:49 +0200 Subject: [PATCH 2/4] IPMIView: 2.14.0 --> 2.16.0 Notes: * Previous URL is no longer accesible * build has to be adjusted for the updated JRE bundle --- pkgs/applications/misc/ipmiview/default.nix | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/misc/ipmiview/default.nix b/pkgs/applications/misc/ipmiview/default.nix index 991a706cc6a..17b552a141b 100644 --- a/pkgs/applications/misc/ipmiview/default.nix +++ b/pkgs/applications/misc/ipmiview/default.nix @@ -1,33 +1,37 @@ -{ stdenv, fetchurl, patchelf, makeWrapper, xorg, gcc, gcc-unwrapped }: +{ stdenv, fetchurl, patchelf, makeWrapper, xorg, fontconfig, freetype, gcc, gcc-unwrapped }: stdenv.mkDerivation rec { pname = "IPMIView"; - version = "2.14.0"; - buildVersion = "180213"; + version = "2.16.0"; + buildVersion = "190815"; src = fetchurl { - url = "ftp://ftp.supermicro.com/utility/IPMIView/Linux/IPMIView_${version}_build.${buildVersion}_bundleJRE_Linux_x64.tar.gz"; - sha256 = "1wp22wm7smlsb25x0cck4p660cycfczxj381930crd1qrf68mw4h"; + 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; '' - patchelf --set-rpath "${stdenv.lib.makeLibraryPath [ libX11 libXext libXrender libXtst libXi ]}" ./jre/lib/amd64/xawt/libmawt.so + 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 "${stdenv.lib.makeLibraryPath [ libXcursor libX11 libXext libXrender libXtst libXi ]}" --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" ./jre/bin/javaws patchelf --set-rpath "${gcc.cc}/lib:$out/jre/lib/amd64/jli" --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" ./jre/bin/java ''; installPhase = '' mkdir -p $out/bin cp -R . $out/ + + # LD_LIBRARY_PATH: fontconfig is used from java code makeWrapper $out/jre/bin/java $out/bin/IPMIView \ + --set LD_LIBRARY_PATH "${stdenv.lib.makeLibraryPath [ fontconfig ]}" \ --prefix PATH : "$out/jre/bin" \ - --add-flags "-jar $out/IPMIView20.jar" + --add-flags "-jar $out/IPMIView20.jar" \ ''; meta = with stdenv.lib; { license = licenses.unfree; + maintainers = with maintainers; [ vlaci ]; }; } From 15b847821191b5fe80c836cdf7146448603a8928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Wed, 25 Sep 2019 09:10:41 +0200 Subject: [PATCH 3/4] IPMIView: fix iKVM console 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. --- pkgs/applications/misc/ipmiview/default.nix | 32 ++++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/misc/ipmiview/default.nix b/pkgs/applications/misc/ipmiview/default.nix index 17b552a141b..774b84947da 100644 --- a/pkgs/applications/misc/ipmiview/default.nix +++ b/pkgs/applications/misc/ipmiview/default.nix @@ -1,4 +1,14 @@ -{ stdenv, fetchurl, patchelf, makeWrapper, xorg, fontconfig, freetype, gcc, gcc-unwrapped }: +{ stdenv +, fetchurl +, makeWrapper +, patchelf +, fontconfig +, freetype +, gcc +, gcc-unwrapped +, iputils +, psmisc +, xorg }: stdenv.mkDerivation rec { pname = "IPMIView"; @@ -11,12 +21,18 @@ stdenv.mkDerivation rec { }; nativeBuildInputs = [ patchelf makeWrapper ]; - - buildPhase = with xorg; '' + 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 = '' @@ -24,14 +40,22 @@ stdenv.mkDerivation rec { 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" \ + --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" ]; }; } From 3848206bd22fc2e5ba1aa04389ae0517dfacb80c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Wed, 25 Sep 2019 09:59:02 +0200 Subject: [PATCH 4/4] IPMIView: create desktop file --- pkgs/applications/misc/ipmiview/default.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/applications/misc/ipmiview/default.nix b/pkgs/applications/misc/ipmiview/default.nix index 774b84947da..e46df5d59e0 100644 --- a/pkgs/applications/misc/ipmiview/default.nix +++ b/pkgs/applications/misc/ipmiview/default.nix @@ -1,5 +1,6 @@ { stdenv , fetchurl +, makeDesktopItem , makeWrapper , patchelf , fontconfig @@ -35,10 +36,20 @@ stdenv.mkDerivation rec { patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" ./BMCSecurity/${stunnelBinary} ''; + desktopItem = makeDesktopItem rec { + name = "IPMIView"; + exec = "IPMIView"; + desktopName = name; + genericName = "Supermicro BMC manager"; + categories = "Network;Configuration"; + }; + installPhase = '' mkdir -p $out/bin cp -R . $out/ + ln -s ${desktopItem}/share $out/share + # 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