{ lib, pkgs, config, ... }: let cfg = config.services.ese-manual; in { options.services.kpp = { enable = mkEnableOption "ese-manual"; hostName = mkOption { type = types.nullOr types.str; default = null; example = "manual.example.com"; description = '' The hostname the application should be served on. If it is `null`, nginx will not be automatically configured. ''; }; }; config = lib.mkIf cfg.enable { services.nginx = lib.mkIf (cfg.hostName != null) { enable = true; virtualHosts.${cfg.hostName} = { root = pkgs.ese-manual; }; }; }; }