{ config, pkgs, ... }: {
  config.services = {
    nginx = {
      enable = true;

      recommendedGzipSettings = true;
      recommendedOptimisation = true;
      recommendedProxySettings = true;

      virtualHosts.home-manager = {
        default = true;

        locations = {
          "/static".alias = ../ui/main/static;

          "/".extraConfig = ''
            uwsgi_pass unix://${config.services.uwsgi.runDir}/uwsgi.sock;
          '';
        };
      };
    };

    uwsgi = {
      enable = true;

      user = "nginx";
      plugins = [ "python3" ];

      instance = {
        type = "normal";
        pythonPackages = py: [ (py.callPackage ../ui { }) ];

        module = "homemanager.wsgi";
        socket = "${config.services.uwsgi.runDir}/uwsgi.sock";
      };
    };

    udev.extraRules = ''
      KERNEL=="gpiochip*", GROUP="uwsgi", MODE="660"
    '';
  };
}
