{ inputs, lib, config, ... }: let enabled = config.mod.dagbok.enable; nginxEnabled = config.mod.nginx.enable; port = 8093; in { options = { mod.dagbok = { enable = lib.mkEnableOption "Enable dagbok module"; }; }; imports = [ inputs.dagbok.nixosModules.default ]; config = lib.mkIf enabled { mod.homepage.services = [ { name = "Dagbok"; port = port; description = "Work and personal journal"; url = "https://dagbok.ppp.pm"; } ]; services.dagbok = { enable = true; address = "127.0.0.1"; inherit port; secureCookies = true; timeZone = "Europe/Stockholm"; publicUrl = "https://dagbok.ppp.pm"; tokenFile = config.age.secrets."dagbok-token".path; }; services.nginx = lib.mkIf nginxEnabled { virtualHosts."dagbok.ppp.pm" = { forceSSL = true; useACMEHost = "dagbok.ppp.pm"; extraConfig = '' client_max_body_size 32m; ''; locations."/" = { proxyPass = "http://127.0.0.1:${toString port}"; }; }; }; age.secrets."dagbok-token".file = ../../../../secrets/manatee/dagbok-token.age; }; }