Files
nixos/services/radicale.nix

61 lines
1.2 KiB
Nix

# Module: services/radicale
# Enables a Radicale server
{
config,
lib,
pkgs,
pkgsUnstable,
inputs,
...
}:
with lib;
let
cfg = config.radicale;
radicalePort = 5232;
in
{
options.radicale = {
enable = mkEnableOption "Enables radicale module";
};
config = mkIf cfg.enable {
services.radicale = {
enable = true;
package = pkgsUnstable.radicale;
settings = {
server = {
hosts = "127.0.0.1:${toString radicalePort}";
};
auth = {
type = "htpasswd";
# TODO use SOPS secrets here
htpasswd_filename = "/srv/radicale/config/users";
};
rights = {
file = "/srv/radicale/config/rights";
};
storage = {
filesystem_folder = "/srv/radicale/collections";
};
};
};
services.traefik.dynamicConfigOptions = {
http.routers.radicale = {
entrypoints = [ "web" ];
rule = "Host(`dav.its-et.me`)";
tls = false;
service = "radicale";
};
http.services.radicale.loadbalancer.servers = [
{
url = "http://127.0.0.1:${toString radicalePort}";
}
];
};
};
}