format + tree-sitter
This commit is contained in:
@@ -44,7 +44,10 @@ in
|
||||
};
|
||||
|
||||
system.activationScripts.initrdSshHostKey = {
|
||||
deps = [ "users" "groups" ];
|
||||
deps = [
|
||||
"users"
|
||||
"groups"
|
||||
];
|
||||
text = ''
|
||||
install -d -m 700 "$(dirname "${cfg.hostKeyPath}")"
|
||||
if [ ! -f "${cfg.hostKeyPath}" ]; then
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
let
|
||||
radicaleHostFor = domain: "cal.${domain}";
|
||||
|
||||
mkThunderbirdAutoconfig = domain:
|
||||
mkThunderbirdAutoconfig =
|
||||
domain:
|
||||
pkgs.writeText "autoconfig-${domain}.xml" ''
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<clientConfig version="1.1">
|
||||
@@ -47,7 +48,8 @@ let
|
||||
</clientConfig>
|
||||
'';
|
||||
|
||||
mkOutlookAutodiscover = domain:
|
||||
mkOutlookAutodiscover =
|
||||
domain:
|
||||
pkgs.writeText "autodiscover-${domain}.xml" ''
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
|
||||
@@ -80,40 +82,39 @@ let
|
||||
</Autodiscover>
|
||||
'';
|
||||
|
||||
mailDiscoveryVirtualHosts =
|
||||
lib.listToAttrs (
|
||||
lib.concatMap (
|
||||
domain:
|
||||
let
|
||||
autoconfigXml = mkThunderbirdAutoconfig domain;
|
||||
autodiscoverXml = mkOutlookAutodiscover domain;
|
||||
in
|
||||
[
|
||||
{
|
||||
name = "autoconfig.${domain}";
|
||||
value = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."= /mail/config-v1.1.xml".extraConfig = ''
|
||||
default_type application/xml;
|
||||
alias ${autoconfigXml};
|
||||
'';
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "autodiscover.${domain}";
|
||||
value = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."= /autodiscover/autodiscover.xml".extraConfig = ''
|
||||
default_type application/xml;
|
||||
alias ${autodiscoverXml};
|
||||
'';
|
||||
};
|
||||
}
|
||||
]
|
||||
) config.mailserver.domains
|
||||
);
|
||||
mailDiscoveryVirtualHosts = lib.listToAttrs (
|
||||
lib.concatMap (
|
||||
domain:
|
||||
let
|
||||
autoconfigXml = mkThunderbirdAutoconfig domain;
|
||||
autodiscoverXml = mkOutlookAutodiscover domain;
|
||||
in
|
||||
[
|
||||
{
|
||||
name = "autoconfig.${domain}";
|
||||
value = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."= /mail/config-v1.1.xml".extraConfig = ''
|
||||
default_type application/xml;
|
||||
alias ${autoconfigXml};
|
||||
'';
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "autodiscover.${domain}";
|
||||
value = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."= /autodiscover/autodiscover.xml".extraConfig = ''
|
||||
default_type application/xml;
|
||||
alias ${autodiscoverXml};
|
||||
'';
|
||||
};
|
||||
}
|
||||
]
|
||||
) config.mailserver.domains
|
||||
);
|
||||
in
|
||||
{
|
||||
services.nginx.virtualHosts = mailDiscoveryVirtualHosts // {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
80
|
||||
443
|
||||
];
|
||||
|
||||
security.acme = {
|
||||
acceptTerms = true;
|
||||
|
||||
@@ -60,14 +60,21 @@ lib.mkIf hasMailDiscoveryConfig (
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
DynamicUser = true;
|
||||
ExecStart = lib.concatStringsSep " " [
|
||||
"${pkgs.python3}/bin/python3"
|
||||
"${generatorScript}"
|
||||
"--domain" domain
|
||||
"--mail-host" cfg.fqdn
|
||||
"--radicale-host" radicaleHost
|
||||
"--port" (toString mobileconfigPort)
|
||||
] + defaultUsernameArg + accountArgs;
|
||||
ExecStart =
|
||||
lib.concatStringsSep " " [
|
||||
"${pkgs.python3}/bin/python3"
|
||||
"${generatorScript}"
|
||||
"--domain"
|
||||
domain
|
||||
"--mail-host"
|
||||
cfg.fqdn
|
||||
"--radicale-host"
|
||||
radicaleHost
|
||||
"--port"
|
||||
(toString mobileconfigPort)
|
||||
]
|
||||
+ defaultUsernameArg
|
||||
+ accountArgs;
|
||||
NoNewPrivileges = true;
|
||||
PrivateTmp = true;
|
||||
ProtectHome = true;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
];
|
||||
dicts = with pkgs.aspellDicts; [
|
||||
# https://search.nixos.org/packages?query=aspellDicts
|
||||
en
|
||||
en
|
||||
sv
|
||||
];
|
||||
maxAttachmentSize = config.mailserver.messageSizeLimit / 1024 / 1024;
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
environment.systemPackages = with pkgs; [
|
||||
lua-language-server
|
||||
stylua
|
||||
tree-sitter
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user