From 7b1c386e14608d4cb9c6f50ac8c3fdcb2526b571 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 14 Apr 2025 17:07:35 +0200 Subject: [PATCH] refactor(shells): simplify environment variable declarations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactored the environment variable setup by consolidating into a single `env` map for better clarity. - Removed `TEE_LD_LIBRARY_PATH` and inlined its logic directly within `LD_LIBRARY_PATH`. - Improved structure and readability of configuration-specific variables like `QCNL_CONF_PATH`. Let us run directly on x86_64: ``` ❯ cargo run --bin verify-era-proof-attestation -- \ --rpc https://mainnet.era.zksync.io \ --continuous 493220 \ --attestation-policy-file bin/verify-era-proof-attestation/examples/attestation_policy.yaml \ --tee-types sgx \ --log-level info ``` --- shells/teepot/default.nix | 40 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/shells/teepot/default.nix b/shells/teepot/default.nix index 7fed35a..ac783f4 100644 --- a/shells/teepot/default.nix +++ b/shells/teepot/default.nix @@ -42,31 +42,23 @@ mkShell { google-cloud-sdk ]; - TEE_LD_LIBRARY_PATH = lib.makeLibraryPath ( - lib.optionals (stdenv.hostPlatform.system == "x86_64-linux") [ - pkgs.curl - nixsgx.sgx-dcap - nixsgx.sgx-dcap.quote_verify - nixsgx.sgx-dcap.default_qpl - ] - ); - - QCNL_CONF_PATH = - if (stdenv.hostPlatform.system != "x86_64-linux") then - "" - else - "${nixsgx.sgx-dcap.default_qpl}/etc/sgx_default_qcnl.conf"; - OPENSSL_NO_VENDOR = "1"; - RUST_SRC_PATH = "${toolchain_with_src}/lib/rustlib/src/rust/library"; + env = { + QCNL_CONF_PATH = + if (stdenv.hostPlatform.system != "x86_64-linux") then + "" + else + "${nixsgx.sgx-dcap.default_qpl}/etc/sgx_default_qcnl.conf"; + OPENSSL_NO_VENDOR = "1"; + RUST_SRC_PATH = "${toolchain_with_src}/lib/rustlib/src/rust/"; + }; shellHook = '' - if [ "x$NIX_LD" = "x" ]; then - export NIX_LD=$(<${stdenv.cc}/nix-support/dynamic-linker) - fi - if [ "x$NIX_LD_LIBRARY_PATH" = "x" ]; then - export NIX_LD_LIBRARY_PATH="$TEE_LD_LIBRARY_PATH" - else - export NIX_LD_LIBRARY_PATH="$NIX_LD_LIBRARY_PATH:$TEE_LD_LIBRARY_PATH" - fi + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${ + pkgs.lib.makeLibraryPath (lib.optionals (stdenv.hostPlatform.system == "x86_64-linux") [ + pkgs.curl + nixsgx.sgx-dcap + nixsgx.sgx-dcap.quote_verify + nixsgx.sgx-dcap.default_qpl + ])}" ''; }