diff options
author | azahi <azat@bahawi.net> | 2025-02-17 02:21:56 +0300 |
---|---|---|
committer | azahi <azat@bahawi.net> | 2025-02-17 02:21:56 +0300 |
commit | 59180328cda59817d71cd58c8f48ead047375064 (patch) | |
tree | 2cdd7d1bfa309839ef624c19daf283f510aacf69 /modules/loki.nix | |
parent | 2025-02-05 (diff) |
2025-02-17
Diffstat (limited to 'modules/loki.nix')
-rw-r--r-- | modules/loki.nix | 23 |
1 files changed, 9 insertions, 14 deletions
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; }; } |