aboutsummaryrefslogtreecommitdiff
path: root/tests/nested-sandboxing/runner.nix
blob: 9a5822c881ace6826b4831466f0b7ab0a9ff3833 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{ altitude, storeFun }:

with import ../config.nix;

mkDerivation {
  name = "nested-sandboxing";
  busybox = builtins.getEnv "busybox";
  EXTRA_SANDBOX = builtins.getEnv "EXTRA_SANDBOX";
  buildCommand = if altitude == 0 then ''
    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

    source common.sh
    source ./nested-sandboxing/command.sh

    runNixBuild ${storeFun} ${toString altitude} >> $out
  '';
}