30 lines
659 B
Nix
30 lines
659 B
Nix
{ lib, pkgs, config, ... }:
|
|
with lib;
|
|
let
|
|
cfg = config.services.ese-manual;
|
|
in
|
|
{
|
|
options.services.ese-manual = {
|
|
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;
|
|
};
|
|
};
|
|
};
|
|
}
|