Compare commits

..
2 changed files with 4 additions and 26 deletions

View file

@ -62,7 +62,7 @@
export HTTPS_PROXY=http://127.0.0.1:7000 export HTTPS_PROXY=http://127.0.0.1:7000
export NO_PROXY=localhost,127.0.0.1 export NO_PROXY=localhost,127.0.0.1
trap "${pkgs.coreutils}/bin/kill $HTTP_SOCAT_PID || true" EXIT trap "${pkgs.coreutils}/bin/kill $HTTP_SOCAT_PID" EXIT
${command pkgs} "$@" ${command pkgs} "$@"
''; '';
@ -145,14 +145,14 @@
${pkgs.socat}/bin/socat UNIX-LISTEN:"$JD/net.sock",fork TCP:127.0.0.1:"$FREE_PORT" &>/dev/null & ${pkgs.socat}/bin/socat UNIX-LISTEN:"$JD/net.sock",fork TCP:127.0.0.1:"$FREE_PORT" &>/dev/null &
SOCAT_PID=$! SOCAT_PID=$!
trap "${pkgs.coreutils}/bin/rm -rf $JD; ${pkgs.coreutils}/bin/kill $PROXY_PID $SOCAT_PID || true" EXIT trap "${pkgs.coreutils}/bin/rm -rf $JD; ${pkgs.coreutils}/bin/kill $PROXY_PID $SOCAT_PID" EXIT
export NIX_CONFIG=" export NIX_CONFIG="
''${NIX_CONFIG:-} ''${NIX_CONFIG:-}
extra-experimental-features = nix-command flakes extra-experimental-features = nix-command flakes
substitute = true" substitute = true"
${jailed}/bin/unsafe-cell "$@" ${jailed}/bin/unsafe-cell
''; '';
in in
host-script host-script

View file

@ -19,7 +19,6 @@ nixpkgs.lib.genAttrs
logDir ? "$JD", logDir ? "$JD",
worktreePath, worktreePath,
nixDaemonSocket ? "/var/nix/daemon-socket", nixDaemonSocket ? "/var/nix/daemon-socket",
extraArgs ? "",
}: }:
let let
cell = unsafe-cell.lib.mkCell.${system} { cell = unsafe-cell.lib.mkCell.${system} {
@ -39,7 +38,7 @@ nixpkgs.lib.genAttrs
export HOME=$(pwd) export HOME=$(pwd)
export LANG=C export LANG=C
mkdir ./cell mkdir ./cell
${cell} ${extraArgs} ${cell}
touch $out touch $out
echo ":: test passed: ${name}" echo ":: test passed: ${name}"
''; '';
@ -380,27 +379,6 @@ nixpkgs.lib.genAttrs
echo "ok 1 - extra combinator env var propagated" echo "ok 1 - extra combinator env var propagated"
''; '';
}; };
# CLI arguments forwarded into the jail
cli-args = mkJailTest "cli-args" {
worktreePath = "./cell";
extraArgs = "foo bar baz";
command =
pkgs:
pkgs.writeScript "cli-args" ''
set -euo pipefail
[ "$1" = "foo" ]
echo "ok 2 - first arg is foo"
[ "$2" = "bar" ]
echo "ok 3 - second arg is bar"
[ "$3" = "baz" ]
echo "ok 4 - third arg is baz"
echo "PASS: CLI arguments forwarded correctly"
'';
};
}; };
allTests = builtins.attrValues tests; allTests = builtins.attrValues tests;