{ inputs, lib, config, ... }: let enabled = config.mod.schema.enable; nginxEnabled = config.mod.nginx.enable; port = 8092; in { options = { mod.schema = { enable = lib.mkEnableOption "Enable schema module"; }; }; imports = [ inputs.schema.nixosModules.default ]; config = lib.mkIf enabled { mod.homepage.services = [ { name = "Schema"; port = port; description = "Our week: chores, meals, dog"; # Login needs HTTPS (Secure cookies), so link to the public vhost. url = "https://schema.ppp.pm"; } ]; services.schema = { enable = true; address = "127.0.0.1"; inherit port; # Served publicly over HTTPS via the nginx vhost below. secureCookies = true; inviteCodeFile = config.age.secrets."schema-invite-code".path; timeZone = "Europe/Stockholm"; }; services.nginx = lib.mkIf nginxEnabled { virtualHosts."schema.ppp.pm" = { forceSSL = true; useACMEHost = "schema.ppp.pm"; locations."/" = { proxyPass = "http://127.0.0.1:${toString port}"; }; }; }; age.secrets."schema-invite-code".file = ../../../../secrets/manatee/schema-invite-code.age; }; }