{ config, lib, ... }:
let
  hostname = "steamdeck";
  wifiSsid = "Joey's Jungle 5G";
in
{
  networking = {
    hostName = lib.mkForce hostname;
    networkmanager = {
      enable = true;
      wifi.powersave = lib.mkDefault false;
      settings.connectivity.uri = lib.mkDefault "http://nmcheck.gnome.org/check_network_status.txt";
      ensureProfiles = {
        environmentFiles = [
          config.sops.secrets.wifi.path
        ];

        profiles = {
          wifiSsid = {
            connection = {
              id = wifiSsid;
              type = "wifi";
            };
            ipv4 = {
              method = "auto";
            };
            ipv6 = {
              addr-gen-mode = "stable-privacy";
              method = "auto";
            };
            wifi = {
              mode = "infrastructure";
              ssid = wifiSsid;
            };
            wifi-security = {
              key-mgmt = "sae";
              psk = "$PSK";
            };
          };
        };
      };
    };
  };
}
