From 59180328cda59817d71cd58c8f48ead047375064 Mon Sep 17 00:00:00 2001 From: azahi Date: Mon, 17 Feb 2025 02:21:56 +0300 Subject: 2025-02-17 --- modules/loki.nix | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'modules/loki.nix') diff --git a/modules/loki.nix b/modules/loki.nix index 75e534b..a9ebb28 100644 --- a/modules/loki.nix +++ b/modules/loki.nix @@ -5,34 +5,33 @@ this, ... }: -with lib; let cfg = config.nixfiles.modules.loki; in { options.nixfiles.modules.loki = { - enable = mkEnableOption "Loki"; + enable = lib.mkEnableOption "Loki"; - port = mkOption { + port = lib.mkOption { description = "Port."; - type = with types; port; + type = lib.types.port; default = 30171; }; - domain = mkOption { + domain = lib.mkOption { description = "Domain name sans protocol scheme."; - type = with types; str; + type = lib.types.str; default = "loki.${config.networking.domain}"; }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { ark.directories = [ config.services.loki.configuration.common.path_prefix ]; - nixfiles.modules.nginx = with cfg; { + nixfiles.modules.nginx = { enable = true; upstreams.loki.servers."127.0.0.1:${toString cfg.port}" = { }; - virtualHosts.${domain} = { + virtualHosts.${cfg.domain} = { locations."/".proxyPass = "http://loki"; extraConfig = libNginx.config.internalOnly; }; @@ -122,10 +121,6 @@ in "d ${storage.filesystem.rules_directory} 0700 loki loki - -" ]; - topology = with cfg; { - nodes.${this.hostname}.services.loki = { - info = domain; - }; - }; + topology.nodes.${this.hostname}.services.loki.info = cfg.domain; }; } -- cgit 1.4.1