forked from aylac.top/nixcfg
this repo has no description
1{ 2 config, 3 lib, 4 ... 5}: let 6 name = "redlib"; 7 cfg = config.myNixOS.services.${name}; 8 9 network = config.mySnippets.tailnet; 10 service = network.networkMap.${name}; 11in { 12 options.myNixOS.services.${name} = { 13 enable = lib.mkEnableOption "${name} server"; 14 autoProxy = lib.mkOption { 15 default = true; 16 example = false; 17 description = "${name} auto proxy"; 18 type = lib.types.bool; 19 }; 20 }; 21 22 config = lib.mkIf cfg.enable { 23 services = { 24 caddy.virtualHosts."${service.vHost}".extraConfig = lib.mkIf cfg.autoProxy '' 25 bind tailscale/${name} 26 encode zstd gzip 27 reverse_proxy ${service.hostName}:${toString service.port} 28 ''; 29 30 redlib = { 31 enable = true; 32 openFirewall = true; 33 inherit (service) port; 34 settings = { 35 ENABLE_RSS = "on"; 36 REDLIB_DEFAULT_SHOW_NSFW = "on"; 37 REDLIB_DEFAULT_USE_HLS = "on"; 38 FULL_URL = "https://${service.vHost}"; 39 }; 40 }; 41 }; 42 }; 43}