0

Have searched https://nixos.org/nixos/options.html#networking for networking options. And I have not found something that may achieve this:

I would like a configuration which ensures that users don't have any network traffic. As it would be a nix generation, running $ nixos-rebuild switch on a configuration.nix file without this network option, could put the computer network communication back to normal.

I have tried mannually calling $ sudo systemctl stop network-manager, but it had no results.

Similarily, nothing seemed to change when I tried modifying this in configuration.nix and then $ nixos-rebuild switch

networking.networkManager.enable = false

Any idea ? Should I manually deal with each of the network interfaces ?

Stephane Rolland
  • 38,876
  • 35
  • 121
  • 169
  • To be clear, there are *lots* of different ways networking can be managed, and `networkManager` is just one of them. So turning off one of several network management subsystems is not the same as turning off networking. – Charles Duffy Sep 09 '19 at 15:28
  • Anyhow -- do you need something that can be plopped into *any* other configuration, or only a specific configuration? If the former, it's arguably too broad to be within our guidelines for "reasonable scope" (if it's on-topic at all, vs being a better fit for [unix.se]). If the latter, we need to know what other network-related configuration is present. – Charles Duffy Sep 09 '19 at 15:29
  • ...so, hopefully the answer I've provided works. That said, I've also voted-to-close as off-topic, being a question less about the Nix language and more about operating-system configuration in NixOS. – Charles Duffy Sep 09 '19 at 15:47

1 Answers1

3

With everything else at defaults, this may be as simple as:

networking.useDHCP = false;
networking.interfaces = {};

Of course, you could also go more heavy-handed -- putting all your network hardware into the blacklistedKernelModules list, f/e -- and personally, I'd recommend that.

Charles Duffy
  • 280,126
  • 43
  • 390
  • 441