+{ config, lib, pkgs, ... }:
+
+with lib;
+let cfg = config.awful.systems.maint-mode;
+in {
+ options.awful.systems.maint-mode = {
+ enable = mkEnableOption (mdDoc ''
+ Whether to configure nginx to display the maintenance mode route as default.
+ '');
+ virtualHost = mkOption {
+ type = types.str;
+ description = lib.mdDoc
+ "The nginx virtualHost to show the maintenance mode route for.";
+ };
+ };
+
+ config = mkIf cfg.enable {
+ services.nginx = {
+ enable = true;
+ virtualHosts."${cfg.virtualHost}" = {
+ root = mkForce (pkgs.callPackage ./site.nix { });
+ };
+ };
+
+ networking.firewall.allowedTCPPorts = [ 80 ];
+ };
+}