Best Practices for Network Tests during Nix-Build

Network test is not supported inside a nix-build except localhost.
How to use localhost and random port?
And is it better to use a network namespace?

This is an interesting question! I suspect the reason that no one tried an answer yet suggests that it is also a hard one. Could you elaborate what exactly you are trying to achieve, maybe with some sample code?

1 Like

If you’re trying to test network protocols and the like,try

https://nixos.org/nixos/manual/index.html#sec-nixos-tests