diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-04-28 15:59:32 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-04-28 15:59:32 +0200 |
commit | a7024544dc072e4fa568e9230100e2ba38862c70 (patch) | |
tree | d26652098d1d8d331b9b49512b48193cde6ae8ca /modules/by-name/ta | |
parent | pkgs/sharkey: 2025.2.2 -> 2025.2.3 (diff) | |
download | nixos-server-a7024544dc072e4fa568e9230100e2ba38862c70.zip |
I realized, that the new taskchampion-sync-server uses a http api (instead of the custom protocol of taskserver). As such, we obviously want to put it behind a ngnix reverse proxy.
Diffstat (limited to '')
-rw-r--r-- | modules/by-name/ta/taskchampion-sync/module.nix | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/modules/by-name/ta/taskchampion-sync/module.nix b/modules/by-name/ta/taskchampion-sync/module.nix index 1870186..a722883 100644 --- a/modules/by-name/ta/taskchampion-sync/module.nix +++ b/modules/by-name/ta/taskchampion-sync/module.nix @@ -8,6 +8,12 @@ in { options.vhack.taskchampion-sync = { enable = lib.mkEnableOption "taskchampion-sync"; + + fqdn = lib.mkOption { + description = "The fully qualified domain name of this instance."; + type = lib.types.str; + example = "task-sync.tw.online"; + }; }; config = lib.mkIf cfg.enable { @@ -16,19 +22,32 @@ in { groups.taskchampion.gid = config.vhack.constants.ids.uids.taskchampion; }; - vhack.persist.directories = [ - { - directory = dataDirectory; - user = "taskchampion"; - group = "taskchampion"; - mode = "0700"; - } - ]; + vhack = { + persist.directories = [ + { + directory = dataDirectory; + user = "taskchampion"; + group = "taskchampion"; + mode = "0700"; + } + ]; + nginx.enable = true; + }; + + services = { + taskchampion-sync-server = { + enable = true; + dataDir = dataDirectory; + }; - services.taskchampion-sync-server = { - enable = true; - openFirewall = true; - dataDir = dataDirectory; + nginx.virtualHosts."${cfg.fqdn}" = { + locations."/" = { + proxyPass = "http://127.0.0.1:${toString config.services.taskchampion-sync-server.port}"; + recommendedProxySettings = true; + }; + enableACME = true; + forceSSL = true; + }; }; }; } |