{ config, lib, pkgs, ... }: let inherit (lib) mkIf; cfg = config.pepe.services.redlib; in { options.pepe.services.redlib = with lib; { enable = mkEnableOption "Enable Redlib"; package = mkPackageOption pkgs "redlib" { }; domain = mkOption { type = types.str; default = null; }; settings = mkOption { type = types.attrsOf types.str; default = { REDLIB_ROBOTS_DISABLE_INDEXING = "on"; REDLIB_DEFAULT_THEME = "dracula"; REDLIB_DEFAULT_SHOW_NSFW = "on"; REDLIB_DEFAULT_BLUR_NSFW = "off"; REDLIB_DEFAULT_USE_HLS = "on"; REDLIB_DEFAULT_HIDE_HLS_NOTIFICATION = "on"; }; description = "Environment variables for Redlib configuration"; }; }; config = mkIf cfg.enable { services.redlib = { enable = true; port = 9090; package = cfg.package; }; systemd.services.redlib.environment = cfg.settings; pepe.core.vhost.hosts.${cfg.domain} = { locations."/" = { port = config.services.redlib.port; allowLAN = true; allowVPN = true; allowWAN = true; }; }; }; }