about summary refs log tree commit diff
path: root/modules/soju.nix
diff options
context:
space:
mode:
authorazahi <azat@bahawi.net>2025-02-17 02:21:56 +0300
committerazahi <azat@bahawi.net>2025-02-17 02:21:56 +0300
commit59180328cda59817d71cd58c8f48ead047375064 (patch)
tree2cdd7d1bfa309839ef624c19daf283f510aacf69 /modules/soju.nix
parent2025-02-05 (diff)
2025-02-17
Diffstat (limited to '')
-rw-r--r--modules/soju.nix31
1 files changed, 15 insertions, 16 deletions
diff --git a/modules/soju.nix b/modules/soju.nix
index dbf069d..f84d9c0 100644
--- a/modules/soju.nix
+++ b/modules/soju.nix
@@ -4,46 +4,45 @@
   pkgs,
   ...
 }:
-with lib;
 let
   cfg = config.nixfiles.modules.soju;
 in
 {
   options.nixfiles.modules.soju = {
-    enable = mkEnableOption "soju";
+    enable = lib.mkEnableOption "soju";
 
-    port = mkOption {
+    port = lib.mkOption {
       description = "Port.";
-      type = with types; port;
+      type = lib.types.port;
       default = 6697;
     };
 
-    httpPort = mkOption {
+    httpPort = lib.mkOption {
       description = "HTTP Port.";
-      type = with types; port;
+      type = lib.types.port;
       default = 9981;
     };
 
-    domain = mkOption {
+    domain = lib.mkOption {
       description = "Domain.";
-      type = with types; str;
+      type = lib.types.str;
       default = config.networking.fqdn;
     };
 
-    uploadsDir = mkOption {
+    uploadsDir = lib.mkOption {
       description = "Uploads directory.";
-      type = with types; str;
+      type = lib.types.str;
       default = "/srv/soju/uploads";
     };
 
     prometheus = {
-      enable = mkEnableOption "Prometheus exporter" // {
+      enable = lib.mkEnableOption "Prometheus exporter" // {
         default = true;
       };
 
-      port = mkOption {
+      port = lib.mkOption {
         description = "Port.";
-        type = with types; port;
+        type = lib.types.port;
         default = 9259;
       };
     };
@@ -53,7 +52,7 @@ in
     let
       db = "soju";
     in
-    mkIf cfg.enable {
+    lib.mkIf cfg.enable {
       nixfiles.modules = {
         acme.enable = true;
         nginx = {
@@ -118,9 +117,9 @@ in
                   listen ircs://:${toString cfg.port}
                   listen http://localhost:${toString cfg.httpPort}
                   tls ${with config.certs.${cfg.domain}; "${directory}/fullchain.pem ${directory}/key.pem"}
-                  ${with cfg.prometheus; optionalString enable "listen http+prometheus://localhost:${toString port}"}
+                  ${lib.optionalString cfg.prometheus.enable "listen http+prometheus://localhost:${toString cfg.prometheus.port}"}
                   db postgres "${
-                    concatStringsSep " " [
+                    lib.concatStringsSep " " [
                       "host=/run/postgresql"
                       "user=${db}"
                       "dbname=${db}"

Consider giving Nix/NixOS a try! <3