Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rename manifest and sigs to app by default via appName parameter #45

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ _:
, extraPostBuild ? ""
, extraChrootCommands ? ""
, appDir ? "/app"
, appName ? "app"
, sigFile ? null
, extendedPackages ? [ ]
, customRecursiveMerge ? null
Expand Down Expand Up @@ -121,7 +122,7 @@ _:
set -e
mkdir -p $out/{etc,var/run}
mkdir -p $out/${appDir}/{.dcap-qcnl,.az-dcap-client}
ln -s ${manifestFile} $out/${appDir}/${name}.manifest.toml
ln -s ${manifestFile} $out/${appDir}/${appName}.manifest.toml
# Increase IPv4 address priority
printf "precedence ::ffff:0:0/96 100\n" > $out/etc/gai.conf
${
Expand Down Expand Up @@ -170,10 +171,10 @@ _:
''
${extraCmd};
if [ -n "$GRAMINE_DIRECT" ]; then
exec gramine-direct ${name};
exec gramine-direct ${appName};
else
[[ -r /var/run/aesmd/aesm.socket ]] || restart-aesmd >&2;
exec gramine-sgx ${name};
exec gramine-sgx ${appName};
fi
''
];
Expand All @@ -200,10 +201,10 @@ _:
(
set -e
cd ${appDir}
HOME=${appDir} ${nixsgx.gramine}/bin/gramine-manifest ${manifestFile} ${name}.manifest;
HOME=${appDir} ${nixsgx.gramine}/bin/gramine-manifest ${manifestFile} ${appName}.manifest;
${nixsgx.gramine}/bin/gramine-sgx-sign \
--manifest ${name}.manifest \
--output ${name}.manifest.sgx \
--manifest ${appName}.manifest \
--output ${appName}.manifest.sgx \
--key ${keyfile};
eval "${extraChrootCommands}"
)
Expand All @@ -221,8 +222,8 @@ _:

includeStorePaths = false;
extraCommands = ''
mkdir -p app
cp ${sigFile} app/nixsgx-test-sgx-azure.sig
mkdir -p ${appDir}
cp ${sigFile} ${appDir}/${appName}.sig
'';
}
else fromImage;
Expand Down
23 changes: 2 additions & 21 deletions packages/nixsgx-test-sgx-azure/default.nix
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
# 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;

{ nixsgx }: nixsgx.nixsgx-test-sgx-dcap.override {
container-name = "nixsgx-test-sgx-azure";
isAzure = true;

manifest = {
sgx = {
edmm_enable = false;
enclave_size = "32M";
max_threads = 2;
};
};
}
9 changes: 6 additions & 3 deletions packages/nixsgx-test-sgx-dcap/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
, inputs
, nixsgx
, hello
, isAzure ? false
, container-name ? "nixsgx-test-sgx-dcap"
, tag ? "latest"
}:
pkgs.callPackage lib.nixsgx.mkSGXContainer {
name = "nixsgx-test-sgx-dcap";
tag = "latest";
name = container-name;
inherit tag isAzure;

packages = [ hello ];
entrypoint = lib.meta.getExe hello;

isAzure = false;
extraCmd = "echo \"Starting ${container-name}\"; gramine-sgx-sigstruct-view app.sig";

manifest = {
sgx = {
Expand Down