nixos/modules/server/caddy.nix
Pablo Ovelleiro Corral 2103ab9f6e
Update NixOS wiki link
2024-06-27 20:37:34 +02:00

31 lines
673 B
Nix

{
config,
lib,
...
}:
# Virtual hosts are configured in each server's caddy.nix. This module
# configures shared auxiliary settings if any are configured.
lib.mkIf (config.services.caddy.virtualHosts != {}) {
# Caddy is a powerful, enterprise-ready, open source web server with
# automatic HTTPS written in Go.
# https://wiki.nixos.org/wiki/Caddy
services.caddy = {
enable = true;
};
networking.firewall = {
allowedTCPPorts = [80 443];
};
environment.persistence."/nix/persist" = {
directories = [
{
directory = "/var/www/html";
user = "caddy";
group = "caddy";
mode = "0755";
}
];
};
}