2021-12-26 17:43:05 +00:00
|
|
|
|
{ cfg }:
|
|
|
|
|
{ config, lib, name, ... }:
|
|
|
|
|
let
|
|
|
|
|
inherit (lib) literalExpression mkOption types;
|
|
|
|
|
in
|
2021-08-22 07:53:02 +00:00
|
|
|
|
{
|
|
|
|
|
options = {
|
2021-12-26 17:43:05 +00:00
|
|
|
|
|
|
|
|
|
hostName = mkOption {
|
|
|
|
|
type = types.str;
|
|
|
|
|
default = name;
|
2022-08-21 13:32:41 +00:00
|
|
|
|
description = lib.mdDoc "Canonical hostname for the server.";
|
2021-12-26 17:43:05 +00:00
|
|
|
|
};
|
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
|
serverAliases = mkOption {
|
2021-12-26 17:43:05 +00:00
|
|
|
|
type = with types; listOf str;
|
2021-08-22 07:53:02 +00:00
|
|
|
|
default = [ ];
|
|
|
|
|
example = [ "www.example.org" "example.org" ];
|
2022-08-21 13:32:41 +00:00
|
|
|
|
description = lib.mdDoc ''
|
2021-08-22 07:53:02 +00:00
|
|
|
|
Additional names of virtual hosts served by this virtual host configuration.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
|
listenAddresses = mkOption {
|
|
|
|
|
type = with types; listOf str;
|
2022-08-21 13:32:41 +00:00
|
|
|
|
description = lib.mdDoc ''
|
2021-12-26 17:43:05 +00:00
|
|
|
|
A list of host interfaces to bind to for this virtual host.
|
|
|
|
|
'';
|
|
|
|
|
default = [ ];
|
|
|
|
|
example = [ "127.0.0.1" "::1" ];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
useACMEHost = mkOption {
|
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
|
default = null;
|
2022-09-09 14:08:57 +00:00
|
|
|
|
description = lib.mdDoc ''
|
2021-12-26 17:43:05 +00:00
|
|
|
|
A host of an existing Let's Encrypt certificate to use.
|
|
|
|
|
This is mostly useful if you use DNS challenges but Caddy does not
|
|
|
|
|
currently support your provider.
|
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
|
*Note that this option does not create any certificates, nor
|
2021-12-26 17:43:05 +00:00
|
|
|
|
does it add subdomains to existing ones – you will need to create them
|
2022-09-09 14:08:57 +00:00
|
|
|
|
manually using [](#opt-security.acme.certs).*
|
2021-12-26 17:43:05 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
logFormat = mkOption {
|
|
|
|
|
type = types.lines;
|
|
|
|
|
default = ''
|
|
|
|
|
output file ${cfg.logDir}/access-${config.hostName}.log
|
|
|
|
|
'';
|
|
|
|
|
defaultText = ''
|
|
|
|
|
output file ''${config.services.caddy.logDir}/access-''${hostName}.log
|
|
|
|
|
'';
|
|
|
|
|
example = literalExpression ''
|
|
|
|
|
mkForce '''
|
|
|
|
|
output discard
|
|
|
|
|
''';
|
|
|
|
|
'';
|
2022-08-21 13:32:41 +00:00
|
|
|
|
description = lib.mdDoc ''
|
2021-12-26 17:43:05 +00:00
|
|
|
|
Configuration for HTTP request logging (also known as access logs). See
|
2022-08-21 13:32:41 +00:00
|
|
|
|
<https://caddyserver.com/docs/caddyfile/directives/log#log>
|
2021-12-26 17:43:05 +00:00
|
|
|
|
for details.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
|
extraConfig = mkOption {
|
|
|
|
|
type = types.lines;
|
|
|
|
|
default = "";
|
2022-08-21 13:32:41 +00:00
|
|
|
|
description = lib.mdDoc ''
|
2021-12-26 17:43:05 +00:00
|
|
|
|
Additional lines of configuration appended to this virtual host in the
|
2022-08-21 13:32:41 +00:00
|
|
|
|
automatically generated `Caddyfile`.
|
2021-08-22 07:53:02 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
2021-12-26 17:43:05 +00:00
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
|
};
|
|
|
|
|
}
|