feat: add mkSGXContainer nix function

to build SGX container in one go.

Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
This commit is contained in:
Harald Hoyer 2024-06-04 13:36:42 +02:00
parent 7151f63b15
commit d2b836216b
Signed by: harald
GPG key ID: F519A1143B3FBE32
6 changed files with 322 additions and 55 deletions

View file

@ -1,28 +0,0 @@
{ lib
, buildEnv
, busybox
, python3
, dockerTools
, nixsgx
}:
dockerTools.buildLayeredImage {
name = "gramine-azure";
tag = "latest";
contents = buildEnv {
name = "image-root";
paths = [
busybox
nixsgx.azure-dcap-client
nixsgx.sgx-psw
nixsgx.sgx-dcap.quote_verify
nixsgx.gramine
];
pathsToLink = [ "/bin" "/lib" "/etc" ];
postBuild = ''
mkdir -p $out/var
ln -s /run $out/var/run
'';
};
}

View file

@ -1,27 +0,0 @@
{ lib
, buildEnv
, dockerTools
, nixsgx
, busybox
, ...
}:
dockerTools.buildLayeredImage {
name = "gramine-dcap";
tag = "latest";
contents = buildEnv {
name = "image-root";
paths = [
busybox
nixsgx.sgx-psw
nixsgx.gramine
nixsgx.sgx-dcap.default_qpl
nixsgx.restart-aesmd
];
pathsToLink = [ "/bin" "/lib" "/etc" ];
postBuild = ''
mkdir -p $out/var
ln -s /run $out/var/run
'';
};
}

View file

@ -0,0 +1,25 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2024 Matter Labs
{ lib
, pkgs
, inputs
, nixsgx
, hello
}:
pkgs.callPackage lib.nixsgx.mkSGXContainer {
name = "nixsgx-test-sgx-azure";
tag = "latest";
packages = [ hello ];
entrypoint = lib.meta.getExe hello;
isAzure = true;
manifest = {
sgx = {
edmm_enable = false;
enclave_size = "32M";
max_threads = 2;
};
};
}

View file

@ -0,0 +1,25 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2024 Matter Labs
{ lib
, pkgs
, inputs
, nixsgx
, hello
}:
pkgs.callPackage lib.nixsgx.mkSGXContainer {
name = "nixsgx-test-sgx-dcap";
tag = "latest";
packages = [ hello ];
entrypoint = lib.meta.getExe hello;
isAzure = false;
manifest = {
sgx = {
edmm_enable = false;
enclave_size = "32M";
max_threads = 2;
};
};
}