mirror of
https://gitlab.com/simple-nixos-mailserver/nixos-mailserver.git
synced 2024-11-11 19:39:16 +05:00
781073b64d
The goal is to remove the WIKI since modifications can not be submitted via PRs.
51 lines
1.1 KiB
ReStructuredText
51 lines
1.1 KiB
ReStructuredText
How to Add Radicale to SNM
|
|
==========================
|
|
|
|
Configuration by @dotlambda
|
|
|
|
.. code:: nix
|
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
mailAccounts = config.mailserver.loginAccounts;
|
|
htpasswd = pkgs.writeText "radicale.users" (concatStrings
|
|
(flip mapAttrsToList mailAccounts (mail: user:
|
|
mail + ":" + user.hashedPassword + "\n"
|
|
))
|
|
);
|
|
|
|
in {
|
|
services.radicale = {
|
|
enable = true;
|
|
config = ''
|
|
[auth]
|
|
type = htpasswd
|
|
htpasswd_filename = ${htpasswd}
|
|
htpasswd_encryption = crypt
|
|
'';
|
|
};
|
|
|
|
services.nginx = {
|
|
enable = true;
|
|
virtualHosts = {
|
|
"cal.example.com" = {
|
|
forceSSL = true;
|
|
enableACME = true;
|
|
locations."/" = {
|
|
proxyPass = "http://localhost:5232/";
|
|
extraConfig = ''
|
|
proxy_set_header X-Script-Name /;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_pass_header Authorization;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
|
}
|