feat(access): taskchampion

This commit is contained in:
arcnmx 2024-09-20 22:22:24 -07:00
parent e6a890915f
commit ab318c0125
6 changed files with 69 additions and 0 deletions

View file

@ -0,0 +1,50 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf mkDefault;
inherit (config.services) taskchampion-sync-server;
name.shortServer = mkDefault "task";
upstreamName = "taskchampion'access";
in {
config.services.nginx = {
upstreams'.${upstreamName}.servers = {
local = {
enable = mkDefault taskchampion-sync-server.enable;
addr = mkDefault "localhost";
port = mkIf taskchampion-sync-server.enable (mkDefault taskchampion-sync-server.port);
};
service = {upstream, ...}: {
enable = mkIf upstream.servers.local.enable (mkDefault false);
accessService = {
name = "taskchampion";
};
};
};
virtualHosts = let
copyFromVhost = mkDefault "taskchampion";
locations = {
"/" = {
proxy.enable = true;
};
};
in {
taskchampion = {
inherit name locations;
proxy.upstream = mkDefault upstreamName;
vouch.enable = mkDefault true;
};
taskchampion'local = {
inherit name locations;
ssl.cert = {
inherit copyFromVhost;
};
proxy = {
inherit copyFromVhost;
};
local.enable = mkDefault true;
};
};
};
}