{ config, lib, ... }:

with lib;

{

  options.profiles.clerie.network-fallback-dhcp = {
    enable = mkEnableOption "Profile for systemd-network falling back to DHCP on all interfaces";
  };

  config = mkIf config.profiles.clerie.network-fallback-dhcp.enable {

    systemd.network.wait-online.anyInterface = true;

    systemd.network.networks."90-lan-dhcp" = {
      matchConfig.Type = "ether";
      networkConfig.DHCP = true;
      linkConfig.RequiredForOnline = "routable";
    };

  };
}