at 25.11-pre 2.2 kB view raw
1{ cfg }: 2{ 3 config, 4 lib, 5 name, 6 ... 7}: 8let 9 inherit (lib) literalExpression mkOption types; 10in 11{ 12 options = { 13 14 hostName = mkOption { 15 type = types.str; 16 default = name; 17 description = "Canonical hostname for the server."; 18 }; 19 20 serverAliases = mkOption { 21 type = with types; listOf str; 22 default = [ ]; 23 example = [ 24 "www.example.org" 25 "example.org" 26 ]; 27 description = '' 28 Additional names of virtual hosts served by this virtual host configuration. 29 ''; 30 }; 31 32 listenAddresses = mkOption { 33 type = with types; listOf str; 34 description = '' 35 A list of host interfaces to bind to for this virtual host. 36 ''; 37 default = [ ]; 38 example = [ 39 "127.0.0.1" 40 "::1" 41 ]; 42 }; 43 44 useACMEHost = mkOption { 45 type = types.nullOr types.str; 46 default = null; 47 description = '' 48 A host of an existing Let's Encrypt certificate to use. 49 This is mostly useful if you use DNS challenges but Caddy does not 50 currently support your provider. 51 52 *Note that this option does not create any certificates, nor 53 does it add subdomains to existing ones you will need to create them 54 manually using [](#opt-security.acme.certs).* 55 ''; 56 }; 57 58 logFormat = mkOption { 59 type = types.lines; 60 default = '' 61 output file ${cfg.logDir}/access-${lib.replaceStrings [ "/" " " ] [ "_" "_" ] config.hostName}.log 62 ''; 63 defaultText = '' 64 output file ''${config.services.caddy.logDir}/access-''${hostName}.log 65 ''; 66 example = literalExpression '' 67 mkForce ''' 68 output discard 69 '''; 70 ''; 71 description = '' 72 Configuration for HTTP request logging (also known as access logs). See 73 <https://caddyserver.com/docs/caddyfile/directives/log#log> 74 for details. 75 ''; 76 }; 77 78 extraConfig = mkOption { 79 type = types.lines; 80 default = ""; 81 description = '' 82 Additional lines of configuration appended to this virtual host in the 83 automatically generated `Caddyfile`. 84 ''; 85 }; 86 87 }; 88}