configuration.nix/hosts/shared/caddy.nix
2024-11-17 14:06:46 +05:30

27 lines
723 B
Nix

{ config, inputs, pkgs, ... }: {
sops = {
secrets = {
"caddy/env_file" = {
mode = "400";
owner = config.users.users.caddy.name;
inherit (config.users.users.caddy) group;
};
};
};
services.caddy = {
enable = true;
package = inputs.caddy.packages.${pkgs.system}.caddy;
email = "admin@acomputer.lol";
enableReload = false;
globalConfig = ''
admin ${config.nodeconfig.facts.wireguard-ip}:2019
acme_dns hetzner {env.HETZNER_ACCESS_TOKEN}
servers {
metrics
}
'';
};
systemd.services.caddy.serviceConfig.EnvironmentFile = config.sops.secrets."caddy/env_file".path;
networking.firewall.allowedTCPPorts = [ 80 443 ];
}