{ inputs, lib, config, ... }: let enabled = config.mod.todo.enable; nginxEnabled = config.mod.nginx.enable; port = 8091; in { options = { mod.todo = { enable = lib.mkEnableOption "Enable todo module"; }; }; imports = [ inputs.todo.nixosModules.default ]; config = lib.mkIf enabled { mod.homepage.services = [ { name = "Todo"; port = port; description = "Offline-first todo"; # Login needs HTTPS (Secure cookies), so link to the public vhost. url = "https://todo.ppp.pm"; } ]; services.todo = { enable = true; address = "127.0.0.1"; inherit port; # Served publicly over HTTPS via the nginx vhost below. secureCookies = true; tokenFile = config.age.secrets."todo-token".path; # sessionSecretFile is left unset: the app generates one in its state dir # (/var/lib/todo) on first boot, mode 0600. }; services.nginx = lib.mkIf nginxEnabled { virtualHosts."todo.ppp.pm" = { forceSSL = true; useACMEHost = "todo.ppp.pm"; locations."/" = { proxyPass = "http://127.0.0.1:${toString port}"; }; }; }; age.secrets."todo-token".file = ../../../../secrets/manatee/todo-token.age; }; }