-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Emmanouil Kampitakis
committed
Sep 16, 2022
1 parent
3ae83c6
commit 85f0887
Showing
4 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
{ lib, pkgs, config, ... }: | ||
|
||
with lib; | ||
|
||
let | ||
cfg = config.services.alps; | ||
in { | ||
options.services.alps = { | ||
enable = mkEnableOption (lib.mdDoc "alps"); | ||
|
||
port = mkOption { | ||
type = types.port; | ||
default = 1323; | ||
description = lib.mdDoc '' | ||
TCP port the service should listen on. | ||
''; | ||
}; | ||
|
||
bindIP = mkOption { | ||
default = "[::]"; | ||
type = types.str; | ||
description = lib.mdDoc '' | ||
The IP the service should listen on. | ||
''; | ||
}; | ||
|
||
theme = mkOption { | ||
type = types.enum [ "alps" "sourcehut" ]; | ||
default = "sourcehut"; | ||
description = lib.mdDoc '' | ||
The frontend's theme to use. | ||
''; | ||
}; | ||
|
||
imaps = { | ||
port = mkOption { | ||
type = types.port; | ||
default = 993; | ||
description = lib.mdDoc '' | ||
The IMAPS server port. | ||
''; | ||
}; | ||
|
||
host = mkOption { | ||
type = types.str; | ||
default = "[::1]"; | ||
example = "mail.example.org"; | ||
description = lib.mdDoc '' | ||
The IMAPS server address. | ||
''; | ||
}; | ||
}; | ||
|
||
smtps = { | ||
port = mkOption { | ||
type = types.port; | ||
default = 445; | ||
description = lib.mdDoc '' | ||
The SMTPS server port. | ||
''; | ||
}; | ||
|
||
host = mkOption { | ||
type = types.str; | ||
default = cfg.imaps.host; | ||
defaultText = "services.alps.imaps.host"; | ||
example = "mail.example.org"; | ||
description = lib.mdDoc '' | ||
The SMTPS server address. | ||
''; | ||
}; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
systemd.services.alps = { | ||
description = "alps is a simple and extensible webmail."; | ||
documentation = [ "https://git.sr.ht/~migadu/alps" ]; | ||
wantedBy = [ "multi-user.target" ]; | ||
after = [ "network.target" "network-online.target" ]; | ||
|
||
serviceConfig = { | ||
ExecStart = '' | ||
${pkgs.alps}/bin/alps \ | ||
-addr ${cfg.bindIP}:${toString cfg.port} \ | ||
-theme ${cfg.theme} \ | ||
imaps://${cfg.imaps.host}:${toString cfg.imaps.port} \ | ||
smpts://${cfg.smtps.host}:${toString cfg.smtps.port} | ||
''; | ||
StateDirectory = "alps"; | ||
WorkingDirectory = "/var/lib/alps"; | ||
DynamicUser = true; | ||
}; | ||
}; | ||
}; | ||
} |