about summary refs log tree commit diff
path: root/nixpkgs/pkgs/os-specific/linux/sgx/sdk/samples.nix
blob: 21b31f824476b5c3e53d73a86ea710b4466f8340 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{ stdenv
, sgx-sdk
, which
}:
let
  buildSample = name: stdenv.mkDerivation rec {
    inherit name;

    src = sgx-sdk.out;
    sourceRoot = "${sgx-sdk.name}/share/SampleCode/${name}";

    buildInputs = [
      sgx-sdk
    ];

    # The samples don't have proper support for parallel building
    # causing them to fail randomly.
    enableParallelBuilding = false;

    buildFlags = [
      "SGX_MODE=SIM"
    ];

    installPhase = ''
      mkdir $out
      install -m 755 app $out/app
      install *.so $out/
    '';

    doInstallCheck = true;
    installCheckInputs = [ which ];
    installCheckPhase = ''
      pushd $out
      ./app
      popd
    '';
  };
in
{
  cxx11SGXDemo = buildSample "Cxx11SGXDemo";
  localAttestation = (buildSample "LocalAttestation").overrideAttrs (oldAttrs: {
    installPhase = ''
      mkdir $out
      cp -r bin/. $out/
    '';
  });
  powerTransition = (buildSample "PowerTransition").overrideAttrs (oldAttrs: {
    # Requires interaction
    doInstallCheck = false;
  });
  protobufSGXDemo = buildSample "ProtobufSGXDemo";
  remoteAttestation = (buildSample "RemoteAttestation").overrideAttrs (oldAttrs: {
    dontFixup = true;
    installCheckPhase = ''
      echo "a" | LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/sample_libcrypto ./app
    '';
  });
  sampleEnclave = buildSample "SampleEnclave";
  sampleEnclavePCL = buildSample "SampleEnclavePCL";
  sampleEnclaveGMIPP = buildSample "SampleEnclaveGMIPP";
  sealUnseal = buildSample "SealUnseal";
  switchless = buildSample "Switchless";
}