about summary refs log tree commit diff
path: root/modules/matrix/element.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/matrix/element.nix')
-rw-r--r--modules/matrix/element.nix25
1 files changed, 12 insertions, 13 deletions
diff --git a/modules/matrix/element.nix b/modules/matrix/element.nix
index 01b991e..6fc336e 100644
--- a/modules/matrix/element.nix
+++ b/modules/matrix/element.nix
@@ -4,28 +4,27 @@
   pkgs,
   ...
 }:
-with lib;
 let
   cfg = config.nixfiles.modules.matrix.element;
 in
 {
   options.nixfiles.modules.matrix.element = {
-    enable = mkEnableOption "Element, a Matrix web interface";
+    enable = lib.mkEnableOption "Element, a Matrix web interface";
 
-    domain = mkOption {
+    domain = lib.mkOption {
       description = "Domain name sans protocol scheme.";
-      type = with types; nullOr str;
+      type = with lib.types; nullOr str;
       default = "element.${config.networking.domain}";
     };
 
-    homeserver = mkOption {
+    homeserver = lib.mkOption {
       description = "Default Matrix homeserver.";
-      type = with types; str;
-      default = my.domain.azahi;
+      type = lib.types.str;
+      default = lib.my.domain.azahi;
     };
   };
 
-  config = mkIf cfg.enable {
+  config = lib.mkIf cfg.enable {
     assertions = [
       {
         assertion =
@@ -35,19 +34,19 @@ in
       }
     ];
 
-    nixfiles.modules.nginx = with cfg; {
+    nixfiles.modules.nginx = {
       enable = true;
-      virtualHosts.${domain}.locations."/".root = pkgs.element-web.override {
+      virtualHosts.${cfg.domain}.locations."/".root = pkgs.element-web.override {
         conf = {
           default_server_config."m.homeserver" = {
-            base_url = "https://${homeserver}";
-            server_name = homeserver;
+            base_url = "https://${cfg.homeserver}";
+            server_name = cfg.homeserver;
           };
           disable_custom_urls = true;
           disable_guests = true;
           disable_login_language_selector = true;
           disable_3pid_login = true;
-          brand = homeserver;
+          brand = cfg.homeserver;
           branding.authFooterLinks = [
             {
               text = "NixOS";

Consider giving Nix/NixOS a try! <3