-
Notifications
You must be signed in to change notification settings - Fork 1
/
default.nix
54 lines (52 loc) · 1.56 KB
/
default.nix
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
let
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs { };
in
pkgs.stdenv.mkDerivation {
name = "sgx-iot";
# FIXME not sure why but the build is non-deterministic if using src = ./.;
# Possibly some untracked file(s) causing the problem ...?
#src = ./.;
# NOTE The commit (rev) cannot include this file, and therefore will, at the very
# best, be one commit behind the commit including this file.
src = pkgs.fetchFromGitHub {
owner = "sbellem";
repo = "sgx-iot";
rev = "5e68ce4442b68870a51fb5d435259ea6d6a29d1c";
#sha256 = pkgs.lib.fakesha256; # ( to get the hash )
sha256 = "sha256-fskdLUeM3lYoQnqrs4yfewKhMIVrbN33mfiyEpKwFoU=";
};
preConfigure = ''
export SGX_SDK=${pkgs.sgx-sdk}/sgxsdk
export PATH=$PATH:$SGX_SDK/bin:$SGX_SDK/bin/x64
export PKG_CONFIG_PATH=$SGX_SDK/pkgconfig
export LD_LIBRARY_PATH=$SGX_SDK/sdk_libs
export SGX_MODE=HW
export SGX_DEBUG=1
'';
#configureFlags = ["--with-sgxsdk=$SGX_SDK"];
buildInputs = with pkgs; [
sgx-sdk
unixtools.xxd
bashInteractive
autoconf
automake
libtool
file
openssl
which
];
buildFlags = ["enclave.signed.so"];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp enclave/enclave.unsigned.so $out/bin/
cp enclave/enclave.signed.so $out/bin/
runHook postInstall
'';
#postInstall = ''
# $sgxsdk/sgxsdk/bin/x64/sgx_sign dump -cssfile enclave_sigstruct_raw -dumpfile /dev/null -enclave $out/bin/Enclave.signed.so
# cp enclave_sigstruct_raw $out/bin/
# '';
dontFixup = true;
}