Actually having internet access in NixOS test

So I’m doing a little NixOS test and I’d like it to have internet connection (I know this is not a good practice but this is just for testing my way around). I’ve read here that you just have to disable the nix sandbox. So I put

nix.useSandbox = false;

However, this is not doing it, my simple command

      [status, out] = machine.execute("ping -c1")

Is giving me

machine # ping: Name or service not known

Am I missing something?

As an aside, It may be wrong to hijack my own question like this but I feel it’s wronger to open a new one just for this: How would I use shell_interact() when launching the test from a flake?

I run my test from a flake output as nix build .#nixosTests.test -L but then a shell_interact() gives me

machine: Terminal is ready (there is no prompt):

Any hint for this one is welcome since I’m still stuck and have no idea what to try next. Here’s a very small code sample that illustrates my problem:

{ pkgs,  ... }:

pkgs.nixosTest {
  name = "internetTest";

  machine = { pkgs, ... }: {
    nix.useSandbox = false;

  testScript = ''

      machine.succeed("ping -c1") # the ip I got from "ping", in case it's something related to DNS

Actually, writing this last one I solved it. Turns out I had to put nix.useSandbox = false in my own config, not in the VM. Sorry for the spam

You can also do nix-build --option sandbox false to avoid a system-wide change.