{
  config,
  lib,
  hostname,
  ...
}:
let
  inherit (config.machine) ipv4 gateway;
in
with lib;
{
  networking = {
    hostName = hostname;
    networkmanager.enable = mkDefault true;
    firewall = {
      enable = true;
      allowPing = true;
    };
    nameservers = [
      "1.1.1.1"
      "1.0.0.1"
      "9.9.9.9"
      "8.8.8.8"
    ];
    interfaces.ens3 = mkIf (ipv4 != null) {
      ipv4.addresses = [
        {
          address = ipv4;
          prefixLength = 32;
        }
      ];
    };
    defaultGateway = mkIf (gateway != null) {
      address = gateway;
      interface = "ens3";
    };
  };
}
