Created
April 8, 2020 17:24
-
-
Save theoo/c599cb2560e29653118e7217d9dfb0ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Auto ### | |
{ stdenv | |
, lib | |
, fetchurl | |
, dpkg | |
, autoPatchelfHook | |
, libxslt | |
}: | |
stdenv.mkDerivation rec { | |
pname = "hponcfg_${version}"; | |
version = "5.5.0.0-1" ; | |
src = fetchurl { | |
url = "https://downloads.linux.hpe.com/SDR/downloads/MCP/Ubuntu/pool/non-free/${pname}_amd64.deb"; | |
sha256 = "492bb5fcff0f7dec086fc26e82d7f7cc30ca0a56be8ee5b45f7aa2b33eb63345"; | |
}; | |
nativeBuildInputs = [ | |
dpkg | |
autoPatchelfHook | |
]; | |
buildInputs = [ libxslt ]; | |
runtimeDependencies = [ | |
libxslt # This is a dependency in the .deb package, but the binary should run without | |
# Works when pointing another build containing the same lib (libhponcfg64.so) | |
# "/nix/store/h01p7wbf7mydn0rph67wz26jl8c2mdpc-hponcfg_5.5.0.0-1-5.5.0.0-1/" | |
]; | |
unpackPhase = "dpkg -x $src ./"; | |
installPhase = '' | |
install -m755 -D usr/sbin/hponcfg $out/sbin/hponcfg | |
''; | |
# Doesn't help | |
# install -m755 -D usr/lib/libhponcfg64.so $out/lib/libhponcfg64.so | |
meta = { | |
description = "HPE RILOE II/iLO online configuration utility"; | |
homepage = https://downloads.linux.hpe.com/SDR/downloads/MCP/Ubuntu/pool/non-free/; | |
license = lib.licenses.unfreeRedistributable; | |
platforms = [ "x86_64-linux" ]; | |
maintainers = with lib.maintainers; [ theo ]; | |
}; | |
} | |
### Manual ### | |
{ stdenv | |
, lib | |
, fetchurl | |
, dpkg | |
, libxslt | |
}: | |
let | |
in stdenv.mkDerivation rec { | |
pname = "hponcfg_${version}"; | |
version = "5.5.0.0-1" ; | |
src = fetchurl { | |
url = "https://downloads.linux.hpe.com/SDR/downloads/MCP/Ubuntu/pool/non-free/${pname}_amd64.deb"; | |
sha256 = "492bb5fcff0f7dec086fc26e82d7f7cc30ca0a56be8ee5b45f7aa2b33eb63345"; | |
}; | |
nativeBuildInputs = [ | |
dpkg | |
]; | |
buildInputs = [ libxslt ]; | |
runtimeDependencies = [ | |
libxslt # This is a dependency in the .deb package, but the binary should run without | |
]; | |
unpackPhase = "dpkg -x $src ./"; | |
installPhase = '' | |
mkdir -p $out/sbin $out/share/doc $out/lib | |
executable=$out/sbin/hponcfg | |
lib=$out/lib/libhponcfg64.so | |
mv usr/sbin/hponcfg $executable | |
mv usr/share/doc/hponcfg $out/share/doc/ | |
mv usr/lib/libhponcfg64.so $lib | |
chmod +w $executable $lib | |
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ | |
--set-rpath "$out/lib" \ | |
$executable | |
''; | |
# patchelf --add-needed $lib $executable # doesn't work | |
meta = { | |
description = "HPE RILOE II/iLO online configuration utility"; | |
homepage = https://downloads.linux.hpe.com/SDR/downloads/MCP/Ubuntu/pool/non-free/; | |
license = lib.licenses.unfreeRedistributable; | |
platforms = [ "x86_64-linux" ]; | |
maintainers = with lib.maintainers; [ theo ]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment