{ config, lib, pkgs, ... }: let domain = ${config.server.misc.lauti.subdomain}.${config.networking.domain}; in { options = { server.misc.lauti = { enable = lib.mkEnableOption "enable lauti"; port = lib.mkOption { default = 3333; description = "lauti port"; }; public = lib.mkEnableOption "make lauti public"; domain = lib.mkOption { default = ""; description = "lauti domain"; }; subdomain = lib.mkOption { default = "lauti"; description = "lauti subdomain"; }; }; }; config = { services = { lauti = { enable = config.server.misc.lauti.enable; settings = { LAUTI_ADMIN_EMAIL = "lauti@${config.networking.domain}"; LAUTI_BASE_URL = "https://${domain}"; LAUTI_OSM_TILE_CACHE_DIR = "/var/lib/lauti/osm"; LAUTI_OSM_TILE_SERVER = "https://tile.openstreetmap.org/{z}/{x}/{y}.png"; LAUTI_TIMEZONE = "Europe/Berlin"; LAUTI_LANGUAGE = config.console.keyMap; }; secrets = [ /home/${config.user.userName}/secrets/lauti ]; }; nginx = { virtualHosts = { "${domain}" = if config.server.misc.lauti.public then { enableACME = true; forceSSL = true; locations."/" = { proxyPass = "http://127.0.0.1:${toString config.server.misc.lauti.port}"; }; } else { }; }; }; }; }; }