2023-07-13 17:17:17 +00:00
|
|
|
{ altitude, storeFun }:
|
|
|
|
|
|
|
|
with import ../config.nix;
|
|
|
|
|
|
|
|
mkDerivation {
|
|
|
|
name = "nested-sandboxing";
|
|
|
|
busybox = builtins.getEnv "busybox";
|
|
|
|
EXTRA_SANDBOX = builtins.getEnv "EXTRA_SANDBOX";
|
2024-07-08 20:07:06 +00:00
|
|
|
buildCommand = ''
|
|
|
|
set -x
|
|
|
|
set -eu -o pipefail
|
|
|
|
'' + (if altitude == 0 then ''
|
2023-07-13 17:17:17 +00:00
|
|
|
echo Deep enough! > $out
|
|
|
|
'' else ''
|
|
|
|
cp -r ${../common} ./common
|
|
|
|
cp ${../common.sh} ./common.sh
|
|
|
|
cp ${../config.nix} ./config.nix
|
|
|
|
cp -r ${./.} ./nested-sandboxing
|
|
|
|
|
|
|
|
export PATH=${builtins.getEnv "NIX_BIN_DIR"}:$PATH
|
|
|
|
|
2024-11-01 13:56:50 +00:00
|
|
|
export _NIX_TEST_SOURCE_DIR=$PWD
|
|
|
|
export _NIX_TEST_BUILD_DIR=$PWD
|
|
|
|
|
2023-07-13 17:17:17 +00:00
|
|
|
source common.sh
|
|
|
|
source ./nested-sandboxing/command.sh
|
|
|
|
|
|
|
|
runNixBuild ${storeFun} ${toString altitude} >> $out
|
2024-07-08 20:07:06 +00:00
|
|
|
'');
|
2023-07-13 17:17:17 +00:00
|
|
|
}
|