# caddy

## Options

### services.caddy.enable

Whether to enable Caddy web server.

*Type:* boolean

*Default:*

```nix
false
```

*Example:*

```nix
true
```

*Declared by:*

* <https://github.com/cachix/devenv/blob/main/src/modules/services/caddy.nix>

### services.caddy.package

Caddy package to use.

*Type:* package

*Default:*

```nix
pkgs.caddy
```

*Declared by:*

* <https://github.com/cachix/devenv/blob/main/src/modules/services/caddy.nix>

### services.caddy.adapter

Name of the config adapter to use. See <https://caddyserver.com/docs/config-adapters> for the full list.

*Type:* string

*Default:*

```nix
"caddyfile"
```

*Example:*

```nix
"nginx"
```

*Declared by:*

* <https://github.com/cachix/devenv/blob/main/src/modules/services/caddy.nix>

### services.caddy.ca

Certificate authority ACME server. The default (Let’s Encrypt production server) should be fine for most people. Set it to null if you don’t want to include any authority (or if you want to write a more fine-graned configuration manually).

*Type:* null or string

*Default:*

```nix
"https://acme-v02.api.letsencrypt.org/directory"
```

*Example:*

```nix
"https://acme-staging-v02.api.letsencrypt.org/directory"
```

*Declared by:*

* <https://github.com/cachix/devenv/blob/main/src/modules/services/caddy.nix>

### services.caddy.config

Verbatim Caddyfile to use.

Refer to <https://caddyserver.com/docs/caddyfile> for more information.

Caddy v2 supports multiple config formats via adapters (see [`services.caddy.adapter`](#servicescaddyconfig)).

*Type:* strings concatenated with “\n”

*Default:*

```nix
""
```

*Example:*

```nix
''
  # Global options block
  {
    debug
  }


  # Site block
  example.com {
    encode gzip
    log
    root /srv/http
  }
''
```

*Declared by:*

* <https://github.com/cachix/devenv/blob/main/src/modules/services/caddy.nix>

### services.caddy.dataDir

The data directory, for storing certificates. Before 17.09, this would create a .caddy directory. With 17.09 the contents of the .caddy directory are in the specified data directory instead. Caddy v2 replaced CADDYPATH with XDG directories. See <https://caddyserver.com/docs/conventions#file-locations>.

*Type:* absolute path

*Default:*

```nix
"${config.env.DEVENV_STATE}/caddy"
```

*Declared by:*

* <https://github.com/cachix/devenv/blob/main/src/modules/services/caddy.nix>

### services.caddy.email

Email address (for Let’s Encrypt certificate).

*Type:* string

*Default:*

```nix
""
```

*Declared by:*

* <https://github.com/cachix/devenv/blob/main/src/modules/services/caddy.nix>

### services.caddy.resume

Use saved config, if any (and prefer over configuration passed with [`caddy.config`](#servicescaddyconfig)).

*Type:* boolean

*Default:*

```nix
false
```

*Declared by:*

* <https://github.com/cachix/devenv/blob/main/src/modules/services/caddy.nix>

### services.caddy.virtualHosts

Declarative vhost config.

*Type:* attribute set of (submodule)

*Default:*

```nix
{ }
```

*Example:*

```nix
{
  "hydra.example.com" = {
    serverAliases = [ "www.hydra.example.com" ];
    extraConfig = ''''
      encode gzip
      log
      root /srv/http
    '''';
  };
};
```

*Declared by:*

* <https://github.com/cachix/devenv/blob/main/src/modules/services/caddy.nix>

### services.caddy.virtualHosts.\<name>.extraConfig

These lines go into the vhost verbatim.

*Type:* strings concatenated with “\n”

*Default:*

```nix
""
```

*Declared by:*

* <https://github.com/cachix/devenv/blob/main/src/modules/services/caddy.nix>

### services.caddy.virtualHosts.\<name>.serverAliases

Additional names of virtual hosts served by this virtual host configuration.

*Type:* list of string

*Default:*

```nix
[ ]
```

*Example:*

```nix
[
  "www.example.org"
  "example.org"
]
```

*Declared by:*

* <https://github.com/cachix/devenv/blob/main/src/modules/services/caddy.nix>