0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 06:00:33 +03:00

minor tweaks

This commit is contained in:
Taeer Bar-Yam 2022-02-15 19:33:10 -05:00
parent 34e0a1a1f1
commit e1009112b6

View file

@ -1,5 +1,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let let
cfg = config.services.zammad; cfg = config.services.zammad;
serviceConfig = { serviceConfig = {
@ -9,7 +11,7 @@ let
User = "zammad"; User = "zammad";
Group = "zammad"; Group = "zammad";
PrivateTmp = true; PrivateTmp = true;
StateDirectory = builtins.baseNameOf cfg.dataDir; StateDirectory = "zammad";
WorkingDirectory = cfg.dataDir; WorkingDirectory = cfg.dataDir;
EnvironmentFile = cfg.secretsFile; EnvironmentFile = cfg.secretsFile;
@ -24,38 +26,44 @@ in {
options = { options = {
services.zammad = { 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 { package = mkOption {
type = lib.types.package; type = types.package;
default = pkgs.zammad; default = pkgs.zammad;
defaultText = "pkgs.zammad"; defaultText = literalExpression "pkgs.zammad";
description = "Zammad package to use."; description = "Zammad package to use.";
}; };
dataDir = lib.mkOption { dataDir = mkOption {
type = lib.types.path; type = types.path;
default = "/var/lib/zammad"; default = "/var/lib/zammad";
description = '' description = ''
Path to a folder that will contain Zammad working directory. Path to a folder that will contain Zammad working directory.
''; '';
}; };
host = lib.mkOption { host = mkOption {
type = lib.types.str; type = types.str;
default = "127.0.0.1"; default = "127.0.0.1";
example = "192.168.23.42"; example = "192.168.23.42";
description = "Host address."; description = "Host address.";
}; };
port = lib.mkOption { openPorts = mkOption {
type = lib.types.int; type = types.bool;
default = false;
description = "Whether to open firewall ports for Zammad";
};
port = mkOption {
type = types.port;
default = 3000; default = 3000;
description = "Web service port."; description = "Web service port.";
}; };
websocketPort = lib.mkOption { websocketPort = mkOption {
type = lib.types.int; type = types.port;
default = 6042; default = 6042;
description = "Websocket service port."; 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.port
config.services.zammad.websocketPort config.services.zammad.websocketPort
]; ];