summary refs log tree commit diff
path: root/nixos/modules/services/development
diff options
context:
space:
mode:
authorTaeer Bar-Yam <taeer@bar-yam.me>2022-02-15 19:33:10 -0500
committerTaeer Bar-Yam <taeer@bar-yam.me>2022-02-23 10:41:26 -0500
commite1009112b609e0a59fa6e66c87e35e640a10fde5 (patch)
treeb2c82f2e3b35e2b9eccf04ce78316ecfa839613e /nixos/modules/services/development
parent34e0a1a1f13a2d81ffb9a9030dd25f67c3d60006 (diff)
downloadnixpkgs-e1009112b609e0a59fa6e66c87e35e640a10fde5.tar
nixpkgs-e1009112b609e0a59fa6e66c87e35e640a10fde5.tar.gz
nixpkgs-e1009112b609e0a59fa6e66c87e35e640a10fde5.tar.bz2
nixpkgs-e1009112b609e0a59fa6e66c87e35e640a10fde5.tar.lz
nixpkgs-e1009112b609e0a59fa6e66c87e35e640a10fde5.tar.xz
nixpkgs-e1009112b609e0a59fa6e66c87e35e640a10fde5.tar.zst
nixpkgs-e1009112b609e0a59fa6e66c87e35e640a10fde5.zip
minor tweaks
Diffstat (limited to 'nixos/modules/services/development')
-rw-r--r--nixos/modules/services/development/zammad.nix38
1 files changed, 23 insertions, 15 deletions
diff --git a/nixos/modules/services/development/zammad.nix b/nixos/modules/services/development/zammad.nix
index 1ceb2f2dd20..c45f9b90f95 100644
--- a/nixos/modules/services/development/zammad.nix
+++ b/nixos/modules/services/development/zammad.nix
@@ -1,5 +1,7 @@
 { config, lib, pkgs, ... }:
 
+with lib;
+
 let
   cfg = config.services.zammad;
   serviceConfig = {
@@ -9,7 +11,7 @@ let
     User = "zammad";
     Group = "zammad";
     PrivateTmp = true;
-    StateDirectory = builtins.baseNameOf cfg.dataDir;
+    StateDirectory = "zammad";
     WorkingDirectory = cfg.dataDir;
 
     EnvironmentFile = cfg.secretsFile;
@@ -24,38 +26,44 @@ in {
 
   options = {
     services.zammad = {
-      enable = lib.mkEnableOption "Zammad, a web-based, open source user support/ticketing solution.";
+      enable = mkEnableOption "Zammad, a web-based, open source user support/ticketing solution.";
 
-      package = lib.mkOption {
-        type = lib.types.package;
+      package = mkOption {
+        type = types.package;
         default = pkgs.zammad;
-        defaultText = "pkgs.zammad";
+        defaultText = literalExpression "pkgs.zammad";
         description = "Zammad package to use.";
       };
 
-      dataDir = lib.mkOption {
-        type = lib.types.path;
+      dataDir = mkOption {
+        type = types.path;
         default = "/var/lib/zammad";
         description = ''
           Path to a folder that will contain Zammad working directory.
         '';
       };
 
-      host = lib.mkOption {
-        type = lib.types.str;
+      host = mkOption {
+        type = types.str;
         default = "127.0.0.1";
         example = "192.168.23.42";
         description = "Host address.";
       };
 
-      port = lib.mkOption {
-        type = lib.types.int;
+      openPorts = mkOption {
+        type = types.bool;
+        default = false;
+        description = "Whether to open firewall ports for Zammad";
+      };
+
+      port = mkOption {
+        type = types.port;
         default = 3000;
         description = "Web service port.";
       };
 
-      websocketPort = lib.mkOption {
-        type = lib.types.int;
+      websocketPort = mkOption {
+        type = types.port;
         default = 6042;
         description = "Websocket service port.";
       };
@@ -88,9 +96,9 @@ in {
 
   };
 
-  config = lib.mkIf cfg.enable {
+  config = mkIf cfg.enable {
 
-    networking.firewall.allowedTCPPorts = [
+    networking.firewall.allowedTCPPorts = mkIf cfg.openPorts [
       config.services.zammad.port
       config.services.zammad.websocketPort
     ];