about summary refs log tree commit diff
path: root/modules/loki.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/loki.nix')
-rw-r--r--modules/loki.nix23
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;
   };
 }

Consider giving Nix/NixOS a try! <3