dotfiles/modules/services/caddy.nix

27 lines
431 B
Nix
Raw Normal View History

2022-10-02 15:24:25 +00:00
{ config, pkgs, lib, ... }:
let
in {
options = {
caddyServers = lib.mkOption {
type = lib.types.attrs;
description = "Caddy JSON configs for http servers";
};
};
config = {
services.caddy = {
enable = true;
adapter = "''"; # Required to enable JSON
configFile = pkgs.writeText "Caddyfile"
(builtins.toJSON { apps.http.servers = config.caddyServers; });
};
};
}