From 55770604dbecdcb765189553e010aa18f9828f14 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Thu, 3 Jul 2025 11:21:21 +0530 Subject: Remove service router --- modules/service-router.module.nix | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 modules/service-router.module.nix (limited to 'modules/service-router.module.nix') diff --git a/modules/service-router.module.nix b/modules/service-router.module.nix deleted file mode 100644 index e1da4fb..0000000 --- a/modules/service-router.module.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ config, lib, ... }: -with lib; -let - cfg = config.services.service-router; - hostname = name: "${name}.local"; -in { - options.services.service-router = { - enable = mkEnableOption "enable router"; - routes = mkOption { - type = types.attrsOf (types.submodule { options = { - port = mkOption { type = types.int; }; - host = mkOption { type = types.str; default = "127.0.0.1"; }; - protocol = mkOption { type = types.str; default = "http"; }; - }; }); - default = {}; - }; - }; - - config = lib.mkIf cfg.enable { - services.nginx = { - enable = true; - virtualHosts = lib.mapAttrs' (name: val: { - name = hostname name; - value = { - locations."/" = { - proxyPass = "${val.protocol}://${val.host}:${toString val.port}"; - }; - }; - }) cfg.routes; - }; - - networking.hosts."127.0.0.1" = lib.mapAttrsToList (name: _: hostname name) cfg.routes; - }; -} -- cgit v1.3.1