Is it possible to change network config without internet

Situation_1:
computer connected to the internet.
Used for configuring and updating the device with the latest flake config.

  networking.useDHCP = false;
  networking.defaultGateway = "192.168.1.1";
  networking.nameservers = [ "192.168.1.1" ];
  networking.interfaces."enp2s0f0".ipv4.addresses = [
    {
      address = "192.168.1.121";
      prefixLength = 24;
    }
  ];

Situation_2:
computer, poe switch, ipcameras, no internet access
Used in “production”

  networking.useDHCP = false;
  networking.interfaces."enp2s0f0".ipv4.addresses = [
    {
      # Our ipcamera subnet: 172.17.246.0/24
      address = "172.17.246.10";
      prefixLength = 24;
    }
  ];

If I had 2 physical interfaces they both work at the same time. But the rpi4(which will eventually run this config) has only 1.

I could:

  • Test/run “Offline-configuration”
  • Rollback to the “Internet configuration”
    sudo nixos-rebuild switch --rollback
  • Remove all but current-internet-config
    sudo nix-collect-garbage -d
  • Deploy the new configuration
    sudo nixos-rebuild switch --flake ".#"

Is there a way to nixos-rebuild switch without internet access? It’s only to change the network settings. Nothing new gets installed.

So it’s available on your LAN and you could connect to it, it’s just blocked from the internet?

Assuming yes, you could use:

nixos-rebuild --flake --target-host 172.17.246.10 --build-host localhost --use-remote-sudo switch

To build on a internet-connected machine and push the results to your camera, assuming you have SSH access to it.

You’ll need to set nix.trustedUsers on the camera too.

If it’s completely airgapped there’s probably a way too, I thought it should work but clearly you have tried and it does not.