{ pkgs
, config
, ...}: {
  services.home-assistant = {
    enable = true;
    config = null;
    configDir = "/nix/persist/service/hass";

    extraComponents = [
      "default_config"
      "met"
      "esphome"
      "mqtt"
      "synology_dsm"
    ];

    extraPackages = python3Packages: with python3Packages; [
      aiogithubapi gtts radios
    ];
  };

  services.nginx.virtualHosts."home.514fpv.io" = {
    useACMEHost = ".514fpv.io";
    addSSL = true;
    extraConfig = ''
      proxy_buffering off;
    '';
    locations."/" = {
      proxyPass = "http://127.0.0.1:8123";
      proxyWebsockets = true;
    };
  };

  global.fs.zfs.mountpoints."/nix/persist/service/hass" = "service/hass";

  nixpkgs.config.permittedInsecurePackages = [ "openssl-1.1.1w" ];
}
