Set up state directory for webmail
This commit is contained in:
parent
fe27dc3f3d
commit
cc0a8b5cba
@ -6,13 +6,12 @@ let
|
|||||||
|
|
||||||
cfg = config.fudo.webmail;
|
cfg = config.fudo.webmail;
|
||||||
|
|
||||||
|
base-data-path = cfg.state-directory;
|
||||||
|
|
||||||
webmail-user = cfg.user;
|
webmail-user = cfg.user;
|
||||||
webmail-group = cfg.group;
|
webmail-group = cfg.group;
|
||||||
|
|
||||||
base-data-path = "/run/rainloop";
|
concatMapAttrs = f: attrs: foldr (a: b: a // b) { } (mapAttrsToList f attrs);
|
||||||
|
|
||||||
concatMapAttrs = f: attrs:
|
|
||||||
foldr (a: b: a // b) {} (mapAttrsToList f attrs);
|
|
||||||
|
|
||||||
fastcgi-conf = builtins.toFile "fastcgi.conf" ''
|
fastcgi-conf = builtins.toFile "fastcgi.conf" ''
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
@ -57,7 +56,8 @@ let
|
|||||||
'';
|
'';
|
||||||
})) cfg.sites;
|
})) cfg.sites;
|
||||||
|
|
||||||
siteOpts = { site-host, ... }: with types; {
|
siteOpts = { name, ... }:
|
||||||
|
with types; {
|
||||||
options = {
|
options = {
|
||||||
title = mkOption {
|
title = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
@ -130,6 +130,11 @@ let
|
|||||||
default = true;
|
default = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
state-directory = mkOption {
|
||||||
|
type = str;
|
||||||
|
description = "The path at which to store server state.";
|
||||||
|
};
|
||||||
|
|
||||||
database = mkOption {
|
database = mkOption {
|
||||||
type = nullOr (submodule databaseOpts);
|
type = nullOr (submodule databaseOpts);
|
||||||
description = "Database configuration for storing contact data.";
|
description = "Database configuration for storing contact data.";
|
||||||
@ -150,7 +155,8 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
databaseOpts = { ... }: with types; {
|
databaseOpts = { ... }:
|
||||||
|
with types; {
|
||||||
options = {
|
options = {
|
||||||
type = mkOption {
|
type = mkOption {
|
||||||
type = enum [ "pgsql" "mysql" ];
|
type = enum [ "pgsql" "mysql" ];
|
||||||
@ -240,9 +246,8 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
security.acme.certs = mapAttrs
|
security.acme.certs =
|
||||||
(site: site-cfg: { email = site-cfg.admin-email; })
|
mapAttrs (site: site-cfg: { email = site-cfg.admin-email; }) cfg.sites;
|
||||||
cfg.sites;
|
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
phpfpm = {
|
phpfpm = {
|
||||||
@ -298,11 +303,12 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
fudo.secrets.host-secrets.${hostname} = concatMapAttrs
|
fudo.secrets.host-secrets.${hostname} = concatMapAttrs (site: site-cfg:
|
||||||
(site: site-cfg: let
|
let
|
||||||
|
|
||||||
site-config-file = builtins.toFile "${site}-rainloop.cfg"
|
site-config-file = builtins.toFile "${site}-rainloop.cfg"
|
||||||
(import ./include/rainloop.nix lib site site-cfg site-packages.${site}.version);
|
(import ./include/rainloop.nix lib site site-cfg
|
||||||
|
site-packages.${site}.version);
|
||||||
|
|
||||||
domain-config-file = builtins.toFile "${site}-domain.cfg" ''
|
domain-config-file = builtins.toFile "${site}-domain.cfg" ''
|
||||||
imap_host = "${site-cfg.mail-server}"
|
imap_host = "${site-cfg.mail-server}"
|
||||||
@ -341,8 +347,10 @@ in {
|
|||||||
webmail-init = let
|
webmail-init = let
|
||||||
link-configs = concatStringsSep "\n" (mapAttrsToList (site: site-cfg:
|
link-configs = concatStringsSep "\n" (mapAttrsToList (site: site-cfg:
|
||||||
let
|
let
|
||||||
cfg-file = config.fudo.secrets.host-secrets.${hostname}."${site}-site-config".target-file;
|
cfg-file =
|
||||||
domain-cfg-file = config.fudo.secrets.host-secrets.${hostname}."${site}-domain-config".target-file;
|
config.fudo.secrets.host-secrets.${hostname}."${site}-site-config".target-file;
|
||||||
|
domain-cfg-file =
|
||||||
|
config.fudo.secrets.host-secrets.${hostname}."${site}-domain-config".target-file;
|
||||||
in ''
|
in ''
|
||||||
${pkgs.coreutils}/bin/mkdir -p ${base-data-path}/${site}/_data_/_default_/configs
|
${pkgs.coreutils}/bin/mkdir -p ${base-data-path}/${site}/_data_/_default_/configs
|
||||||
${pkgs.coreutils}/bin/cp ${cfg-file} ${base-data-path}/${site}/_data_/_default_/configs/application.ini
|
${pkgs.coreutils}/bin/cp ${cfg-file} ${base-data-path}/${site}/_data_/_default_/configs/application.ini
|
||||||
|
Loading…
x
Reference in New Issue
Block a user