{
  lib,
  config,
  pkgs,
  ...
}: let
  inherit (lib) mkEnableOption mkIf;
  cfg = config.horseman.hardware.wifi;
in {
  options = {
    horseman.hardware.wifi = {
      enable = mkEnableOption "";
    };
  };

  config = mkIf cfg.enable {
    environment.systemPackages = with pkgs; [
      wpa_supplicant_gui
    ];

    networking.wireless = {
      enable = true;
      userControlled.enable = true;
      allowAuxiliaryImperativeNetworks = true;

      secretsFile = toString config.age.secrets.wifi.path;

      networks = {
        "Wi-Fi de Ruiters" = {
          pskRaw = "ext:psk_ruiter";
        };

        "TMNL-6DA8C1" = {
          pskRaw = "ext:psk_tmnl6da8c1";
        };

        "kargadoor" = {
          pskRaw = "ext:psk_kargadoor";
        };

        "Hete plek" = {
          pskRaw = "ext:psk_hotspot";
        };

        "Woestgaafsecure Gamelab" = {
          pskRaw = "ext:psk_sticky";
        };

        "Utrecht University" = {
          authProtocols = ["WPA-EAP"];
          auth = ''
            eap=PEAP
            identity="k.j.deruiter@students.uu.nl"
            password=ext:psk_uni
            phase2="auth=MSCHAPV2"
          '';
        };

        "eduroam" = {
          authProtocols = ["WPA-EAP"];
          auth = ''
            eap=PEAP
            identity="k.j.deruiter@students.uu.nl"
            password=ext:psk_uni
            phase2="auth=MSCHAPV2"
          '';
        };
      };
    };
  };
}
