1 { lib, pkgs, config, ... }:
6 cfg = config.services.alps;
8 options.services.alps = {
9 enable = mkEnableOption "alps";
15 TCP port the service should listen on.
23 The IP the service should listen on.
28 type = types.enum [ "alps" "sourcehut" ];
29 default = "sourcehut";
31 The frontend's theme to use.
40 The IMAPS server port.
47 example = "mail.example.org";
49 The IMAPS server address.
59 The SMTPS server port.
65 default = cfg.imaps.host;
66 defaultText = "services.alps.imaps.host";
67 example = "mail.example.org";
69 The SMTPS server address.
82 type = types.listOf types.str;
84 "-addr" "${cfg.bindIP}:${toString cfg.port}"
85 "-theme" "${cfg.theme}"
86 "imaps://${cfg.imaps.host}:${toString cfg.imaps.port}"
87 "smtps://${cfg.smtps.host}:${toString cfg.smtps.port}"
92 config = mkIf cfg.enable {
93 systemd.services.alps = {
94 description = "alps is a simple and extensible webmail.";
95 documentation = [ "https://git.sr.ht/~migadu/alps" ];
96 wantedBy = [ "multi-user.target" ];
97 wants = [ "network-online.target" ];
98 after = [ "network.target" "network-online.target" ];
101 ExecStart = "${cfg.package}/bin/alps ${escapeShellArgs cfg.args}";
102 AmbientCapabilities = "";
103 CapabilityBoundingSet = "";
105 LockPersonality = true;
106 MemoryDenyWriteExecute = true;
107 NoNewPrivileges = true;
108 PrivateDevices = true;
113 ProtectControlGroups = true;
115 ProtectHostname = true;
116 ProtectKernelLogs = true;
117 ProtectKernelModules = true;
118 ProtectKernelTunables = true;
119 ProtectProc = "invisible";
120 ProtectSystem = "strict";
122 RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ];
123 RestrictNamespaces = true;
124 RestrictRealtime = true;
125 RestrictSUIDSGID = true;
126 SocketBindAllow = cfg.port;
127 SocketBindDeny = "any";
128 SystemCallArchitectures = "native";
129 SystemCallFilter = [ "@system-service" "~@privileged @obsolete" ];