File tree 3 files changed +18
-21
lines changed
3 files changed +18
-21
lines changed Original file line number Diff line number Diff line change 1
1
{ ... } :
2
2
{
3
3
services . mox . enable = true ;
4
- services . mox . hostname = "mail " ;
5
- services . mox . user = "admin@example.ke " ;
4
+ services . mox . hostname = "localhost " ;
5
+ services . mox . user = "admin@localhost " ;
6
6
}
Original file line number Diff line number Diff line change 46
46
} ;
47
47
48
48
systemd . services . mox-setup = {
49
- description = "Setup Mox Mail Server" ;
49
+ description = "Setup Mox Mail Server Configuration Files " ;
50
50
wantedBy = [ "multi-user.target" ] ;
51
+ requires = [ "network-online.target" ] ;
52
+ after = [ "network-online.target" ] ;
51
53
before = [ "mox.service" ] ;
52
54
serviceConfig = {
53
55
Type = "oneshot" ;
54
56
RemainAfterExit = true ;
57
+ User = "mox" ;
58
+ Group = "mox" ;
55
59
} ;
56
60
script = ''
57
- mkdir -p /var/lib/mox
58
- cd /var/lib/mox
59
- ${ pkgs . mox } /bin/mox quickstart -hostname ${ config . services . mox . hostname } ${ config . services . mox . user }
60
- chown -R mox:mox /var/lib/mox
61
+ mkdir -p /var/lib/mox
62
+ cd /var/lib/mox
63
+ ${ pkgs . mox } /bin/mox quickstart -hostname ${ config . services . mox . hostname } ${ config . services . mox . user }
61
64
'' ;
62
65
} ;
63
66
64
67
systemd . services . mox = {
65
68
wantedBy = [ "multi-user.target" ] ;
66
- after = [ "network.target" " mox-setup.service" ] ;
67
- requires = [ "mox-setup.service" ] ; # This ensures mox-setup must succeed
69
+ after = [ "mox-setup.service" ] ;
70
+ requires = [ "mox-setup.service" ] ;
68
71
serviceConfig = {
69
72
WorkingDirectory = "/var/lib/mox" ;
70
73
ExecStart = "${ pkgs . mox } /bin/mox -config /var/lib/mox/config/mox.conf serve" ;
Original file line number Diff line number Diff line change 9
9
nodes = {
10
10
machine =
11
11
{ ... } :
12
- {
12
+ rec {
13
13
imports = [
14
14
sources . modules . ngipkgs
15
- # Sources module path depends on your folder structure
16
- ./module.nix
15
+ sources . modules . services . mox
16
+ sources . examples . Mox . mox
17
17
] ;
18
18
19
- # Configure the mox service
20
- services . mox = {
21
- enable = true ;
22
- hostname = "mail.example.com" ;
23
-
24
- } ;
25
-
26
19
# Allow necessary ports through the firewall
27
- networking . firewall . allowedTCPPorts = [ 25 143 587 993 ] ;
20
+ networking . firewall . allowedTCPPorts = [ 25 80 143 443 587 993 ] ;
21
+ networking . firewall . allowedUDPPorts = [ 53 ] ;
28
22
} ;
29
23
} ;
30
24
37
31
machine.wait_for_unit("multi-user.target")
38
32
39
33
# Verify the mox-setup service has run successfully
40
- # machine.wait_for_unit("mox-setup.service")
34
+ machine.wait_for_unit("mox-setup.service")
41
35
42
36
# Verify the mox service is running
43
37
machine.wait_for_unit("mox.service")
You can’t perform that action at this time.
0 commit comments