{ config, lib, options, pkgs, ... }: with lib; let cfg = config.local.web.sites.cgit; inherit (config.local) domains; in { options.local.web.sites.cgit = { enable = mkEnableOption "cgit site"; repos = mkOption { default = {}; type = (options.services.cgit.type.nestedTypes.elemType.getSubOptions {}).repos.type; }; }; config = mkIf cfg.enable { local.web = { enable = mkDefault true; ownedCerts = ["cgit"]; }; services = { cgit.${domains.cgit.main} = { enable = true; inherit (cfg) repos; settings = { enable-follow-links = true; source-filter = "${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py"; }; }; nginx.virtualHosts.${domains.cgit.main} = { forceSSL = true; useACMEHost = domains.cgit.main; }; }; }; }