2023-10-23 10:12:21 +02:00
|
|
|
{ lib, pkgs, config, ... }:
|
2023-10-23 10:26:27 +02:00
|
|
|
with lib;
|
2023-10-23 10:12:21 +02:00
|
|
|
let
|
|
|
|
cfg = config.services.ese-manual;
|
|
|
|
in
|
|
|
|
{
|
2023-10-23 10:22:35 +02:00
|
|
|
options.services.ese-manual = {
|
2023-10-23 10:12:21 +02:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|