Add radicale

This commit is contained in:
Bun 2025-03-19 21:17:08 -04:00
parent 9b49b26673
commit 904ff3a16d
5 changed files with 63 additions and 23 deletions

View file

@ -2,6 +2,7 @@
{ {
imports = [ imports = [
./go-autoconfig ./go-autoconfig
./radicale
./roundcube ./roundcube
./simplenix ./simplenix
]; ];

View file

@ -2,8 +2,7 @@
{ {
imports = [ ./nginx ]; imports = [ ./nginx ];
config = lib.mkIf config.services.mailserver.enable { services = lib.mkIf config.services.mailserver.enable {
services = {
go-autoconfig = { go-autoconfig = {
enable = true; enable = true;
settings = { settings = {
@ -21,5 +20,4 @@
}; };
cloudflare-dyndns.domains = [ config.services.go-autoconfig.settings.domain ]; cloudflare-dyndns.domains = [ config.services.go-autoconfig.settings.domain ];
}; };
};
} }

View file

@ -0,0 +1,25 @@
{ config, lib, pkgs, ... }:
{
imports = [ ./nginx ];
services = lib.mkIf config.services.mailserver.enable {
radicale = {
enable = true;
settings = {
auth = {
type = "htpasswd";
htpasswd_filename = let
mailAccounts = config.mailserver.loginAccounts;
htpasswd = with lib; pkgs.writeText "radicale.users" (concatStrings
(flip mapAttrsToList mailAccounts (mail: user:
mail + ":" + user.hashedPassword + "\n"
))
);
in "${htpasswd}";
htpasswd_encryption = "bcrypt";
};
};
};
cloudflare-dyndns.domains = [ "cal.nixfox.ca" ];
};
}

View file

@ -0,0 +1,16 @@
{ config, lib, ... }:
{
services.nginx.virtualHosts."cal.nixfox.ca" = lib.mkIf config.services.go-autoconfig.enable {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:5232";
proxyWebsockets = true;
extraConfig = ''
proxy_set_header X-Script-Name /;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_header Authorization;
'';
};
};
}

View file

@ -5,13 +5,13 @@
config = lib.mkIf config.services.mailserver.enable { config = lib.mkIf config.services.mailserver.enable {
mailserver = { mailserver = {
enable = true; enable = true;
fqdn = "mx.nixfox.ca";
domains = [ domains = [
"nixfox.ca" "nixfox.ca"
"bloxelcom.net" "bloxelcom.net"
"freecorn1854.win" "freecorn1854.win"
"lunamoonlight.xyz" "lunamoonlight.xyz"
]; ];
fqdn = "mx.nixfox.ca";
certificateScheme = "acme-nginx"; certificateScheme = "acme-nginx";
localDnsResolver = false; localDnsResolver = false;
redis.port = 1515; redis.port = 1515;
@ -19,13 +19,13 @@
# Passwords made with 'mkpasswd -sm bcrypt' # Passwords made with 'mkpasswd -sm bcrypt'
loginAccounts = { loginAccounts = {
"jimbo@nixfox.ca" = { "jimbo@nixfox.ca" = {
hashedPasswordFile = pkgs.writeText "jimbo" config.secrets.mailHash.jimbo; hashedPassword = config.secrets.mailHash.jimbo;
aliases = [ aliases = [
"james@nixfox.ca" "james@nixfox.ca"
"jimbo@bloxelcom.net" "jimbo@bloxelcom.net"
"bun@nixfox.ca" "bun@nixfox.ca"
#"vice@nixfox.ca" "vice@nixfox.ca"
"bun@bloxelcom.net" "bun@bloxelcom.net"
"yara@nixfox.ca" "yara@nixfox.ca"
@ -34,7 +34,7 @@
}; };
"luna@lunamoonlight.xyz" = { "luna@lunamoonlight.xyz" = {
hashedPasswordFile = pkgs.writeText "luna" config.secrets.mailHash.luna; hashedPassword = config.secrets.mailHash.luna;
aliases = [ aliases = [
"luna@bloxelcom.net" "luna@bloxelcom.net"
"contact@bloxelcom.net" "contact@bloxelcom.net"
@ -43,17 +43,17 @@
}; };
"contact@freecorn1854.win" = { "contact@freecorn1854.win" = {
hashedPasswordFile = pkgs.writeText "corn" config.secrets.mailHash.corn; hashedPassword = config.secrets.mailHash.corn;
aliases = [ "freecorn@bloxelcom.net" ]; aliases = [ "freecorn@bloxelcom.net" ];
}; };
# Noreply emails # Noreply emails
"noreply@nixfox.ca" = { "noreply@nixfox.ca" = {
hashedPasswordFile = pkgs.writeText "noreply" config.secrets.mailHash.nixfoxNoReply; hashedPassword = config.secrets.mailHash.nixfoxNoReply;
sendOnly = true; sendOnly = true;
}; };
"noreply@bloxelcom.net" = { "noreply@bloxelcom.net" = {
hashedPasswordFile = pkgs.writeText "noreply" config.secrets.mailHash.bloxelNoReply; hashedPassword = config.secrets.mailHash.bloxelNoReply;
sendOnly = true; sendOnly = true;
}; };
}; };