sgxsdk: add setup hook

main
Vincent Haupert 3 years ago
parent 91cd666010
commit 007b606892
  1. 38
      pkgs/os-specific/linux/sgx-sdk/default.nix

@ -21,6 +21,7 @@
, validatePkgConfig
, which
, writeShellScript
, writeText
}:
stdenv.mkDerivation rec {
@ -219,38 +220,9 @@ stdenv.mkDerivation rec {
doInstallCheck = true;
installCheckInputs = [ which ];
# Run the samples as tests in simulation mode.
# The following samples are omitted:
# - SampleCommonLoader: requires an actual SGX device
# - PowerTransition: requires interaction
installCheckPhase = ''
runHook preInstallCheck
header "Building and running SGX samples"
source $out/share/bin/environment
TESTDIR=$(mktemp -d)
pushd $TESTDIR
cp -r $out/share/SampleCode/. ./
for dir in "Cxx11SGXDemo" "LocalAttestation" "SampleEnclave" "SampleEnclavePCL" "SealUnseal" "Switchless"; do
pushd "$dir/"
make -j $NIX_BUILD_CORES SGX_MODE=SIM
./app || ./bin/app
popd
done
pushd "RemoteAttestation"
make -j $NIX_BUILD_CORES SGX_MODE=SIM
echo "a" | LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/sample_libcrypto ./app
popd
popd
header "Checking symlink targets"
# Make sure all symlinks are valid
output=$(find "$out" -type l -exec test ! -e {} \; -print)
if [[ -n "$output" ]]; then
@ -262,6 +234,14 @@ stdenv.mkDerivation rec {
runHook postInstallCheck
'';
setupHook = writeText "setup-hook.sh" ''
sgxsdk() {
export SGX_SDK=@out@
}
postHooks+=(sgxsdk)
'';
meta = with lib; {
description = "Intel SGX SDK for Linux built with IPP Crypto Library";
homepage = "https://github.com/intel/linux-sgx";

Loading…
Cancel
Save