2021-01-29 14:21:25 +05:00
|
|
|
Add Radicale
|
|
|
|
============
|
2020-07-03 00:02:47 +05:00
|
|
|
|
|
|
|
Configuration by @dotlambda
|
|
|
|
|
2020-11-29 14:58:16 +05:00
|
|
|
Starting with Radicale 3 (first introduced in NixOS 20.09) the traditional
|
2022-11-28 00:14:22 +05:00
|
|
|
crypt passwords are no longer supported. Instead bcrypt passwords
|
|
|
|
have to be used. These can still be generated using `mkpasswd -m bcrypt`.
|
2020-11-29 14:58:16 +05:00
|
|
|
|
2020-07-03 00:02:47 +05:00
|
|
|
.. 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;
|
2024-05-03 12:14:16 +05:00
|
|
|
settings = {
|
|
|
|
auth = {
|
|
|
|
type = "htpasswd";
|
|
|
|
htpasswd_filename = "${htpasswd}";
|
|
|
|
htpasswd_encryption = "bcrypt";
|
|
|
|
};
|
|
|
|
};
|
2020-07-03 00:02:47 +05:00
|
|
|
};
|
|
|
|
|
|
|
|
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 ];
|
|
|
|
}
|