{ config, lib, ... }:
let
  ports = [
    8192
  ];
in
{
  # Networking configs
  networking = {
    hostName = lib.mkForce "nuc-nixos";

    useNetworkd = true;

    # Disable Network Manager
    networkmanager = {
      enable = true;
      ensureProfiles = {
        environmentFiles = [
          config.sops.secrets.wifi.path
        ];

        profiles = {
          "Joey's Jungle 6G" = {
            connection = {
              id = "Joey's Jungle 6G";
              type = "wifi";
            };
            ipv4 = lib.mkForce {
              address1 = "10.0.1.4/24";
              dns = "10.0.1.1";
              gateway = "10.0.1.1";
              method = "manual";
            };
            ipv6 = {
              addr-gen-mode = "stable-privacy";
              method = "auto";
            };
            wifi = {
              mode = "infrastructure";
              ssid = "Joey's Jungle 6G";
            };
            wifi-security = {
              key-mgmt = "sae";
              psk = "$PSK";
            };
          };
        };
      };
    };

    firewall = {
      enable = true;
      allowPing = true;

      allowedTCPPorts = ports;
      allowedUDPPorts = ports;
    };
  };
}
