diff options
Diffstat (limited to 'modules/soju.nix')
-rw-r--r-- | modules/soju.nix | 31 |
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}" |