add reurn value section and add server aliases argument

This commit is contained in:
2021-11-13 18:00:10 +01:00
parent 171f8e6ed1
commit 263a49d48f
3 changed files with 50 additions and 13 deletions

View File

@@ -4,23 +4,55 @@
```nix
{
pkgs ? import <nixpkgs> {},
stateDir ? "/opt/mailcow-dockerized", # install target folder
ptr ? "mail.example.org", # PTR Resource Record https://www.cloudns.net/wiki/article/40/
timeZone ? "Europe/Berlin", # time zone
httpPort ? "80", # http port for mailcow website
httpBind ? "0.0.0.0", # http bind, e.g if you use a reverse proxy then you want that mailcow website us only listen to like 127.0.0.1
httpsPort ? "443", # https port for mailcow website
httpsBind ? "0.0.0.0", # https bind, e.g if you use a reverse proxy then you want that mailcow website us only listen to like 127.0.0.1
skipMailCowAcme ? false, # skip the acme container of mailcow e.g. you use a own one
nginxEnableACME ? true, # enable acme for nginx setting
nginxForceSSL ? true, # force ssl usage for nginx setting
nginxIsDefault ? true, # set mailcow virtual host as default host
pkgs, # parameter for nixpkgs set
stateDir, # install target folder
ptr, # PTR Resource Record https://www.cloudns.net/wiki/article/40/, will be also use as server name for the nginx setting
timeZone, # time zone
httpPort, # http port for mailcow website
httpBind, # http bind, e.g if you use a reverse proxy then you want that mailcow website us only listen to like 127.0.0.1
httpsPort, # https port for mailcow website
httpsBind, # https bind, e.g if you use a reverse proxy then you want that mailcow website us only listen to like 127.0.0.1
skipMailCowAcme, # skip the acme container of mailcow e.g. you use a own one
nginxEnableACME, # enable acme for nginx setting
nginxForceSSL, # force ssl usage for nginx setting
nginxIsDefault, # set mailcow virtual host as default host
nginxServerAliases, # list of additional domains which would handle by the mail cow virtual host
gitUrl ? "https://github.com/mailcow/mailcow-dockerized.git", # mailcow clone url
gitRef ? "master" # git ref for init setup
}
```
## Return value
```nix
{
runMailCow = { # shell script which run the mail cow
command, # the run script
paths # build path for the run script
},
configureMailCow = { # shell script which configure the mail cow
command, # the configure script
paths # build path for the configure script
},
updateMailCow = { # shell script which update the mail cow
command, # the update script
paths # build path for the update script
},
systemd = {
services = {
mailcow, # systemd mail cow service
mailcow-update # systemd mail cow update service
},
timers.mailcow-update # systemd timer which invoke the mail cow update service weekly
},
nginx.virtualHosts.mailCow, # ngnix virtual host setting for the mail cow service
acme = {
certName, # name of the acme cert
postRun # copy the acme script to the mail cow cert path
}
}
```
## Example
### shell
@@ -30,6 +62,7 @@ nix-shell mailcow_nix-shell.nix --run configureMailCow
nix-shell mailcow_nix-shell.nix --run runMailCow
nix-shell mailcow_nix-shell.nix --run updateMailCow
```
for details see `examples/mailcow_nix-build.nix`
### build
@@ -39,6 +72,7 @@ result/bin/configureMailCow
result/bin/runMailCow
result/bin/updateMailCow
```
for details see `examples/mailcow_nix-build.nix`
### nixos

View File

@@ -2,12 +2,13 @@
let
mc = pkgs.callPackage ../mailcow.nix {
ptr = "mail.devel-nixos.org";
ptr = "server.of.devel-nixos.org";
httpPort = "7780";
httpBind = "127.0.0.1";
httpsPort = "7443";
httpsBind = "127.0.0.1";
skipMailCowAcme = true;
nginxServerAliases = [ "mail.devel-nixos.org" ];
};
in
{

View File

@@ -12,6 +12,7 @@
nginxEnableACME ? true,
nginxForceSSL ? true,
nginxIsDefault ? true,
nginxServerAliases ? []
gitUrl ? "https://github.com/mailcow/mailcow-dockerized.git",
gitRef ? "master"
}:
@@ -120,6 +121,7 @@ in
default = nginxIsDefault;
locations."/".proxyPass = "http://localhost:${httpPort}";
serverName = "${ptr}";
serverAliases = nginxServerAliases;
};
};
};