{ pkgs, lib, config, ... }: let cfg = config.cos.grocy; in { options.cos.grocy = { enable = lib.mkEnableOption "enable grocy"; dataDir = lib.mkOption { type = lib.types.str; }; hostname = lib.mkOption { type = lib.types.str; }; }; config = lib.mkIf cfg.enable { services.grocy = { enable = true; hostName = cfg.hostname; dataDir = cfg.dataDir; }; services.nginx.virtualHosts.${cfg.hostname} = { listen = [{ addr = "127.0.0.1"; port = 8303; }]; serverName = null; enableACME = lib.mkForce false; forceSSL = lib.mkForce false; }; services.cloudflared.tunnels.mine.ingress.${cfg.hostname} = "http://127.0.0.1:8303"; }; }