2024-07-09 23:22:56 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2020-03-30 12:29:30 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.magic-wormhole-mailbox-server;
|
2024-07-09 23:22:56 +01:00
|
|
|
# keep semicolon in dataDir for backward compatibility
|
2020-03-30 12:29:30 +01:00
|
|
|
dataDir = "/var/lib/magic-wormhole-mailbox-server;";
|
2024-11-18 07:37:49 +00:00
|
|
|
python = pkgs.python3.withPackages (
|
2024-07-09 23:22:56 +01:00
|
|
|
py: with py; [
|
|
|
|
magic-wormhole-mailbox-server
|
|
|
|
twisted
|
|
|
|
]
|
|
|
|
);
|
2020-03-30 12:29:30 +01:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options.services.magic-wormhole-mailbox-server = {
|
2024-07-09 23:22:56 +01:00
|
|
|
enable = lib.mkEnableOption "Magic Wormhole Mailbox Server";
|
2020-03-30 12:29:30 +01:00
|
|
|
};
|
|
|
|
|
2024-07-09 23:22:56 +01:00
|
|
|
config = lib.mkIf cfg.enable {
|
2020-03-30 12:29:30 +01:00
|
|
|
systemd.services.magic-wormhole-mailbox-server = {
|
|
|
|
after = [ "network.target" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
|
|
DynamicUser = true;
|
|
|
|
ExecStart = "${python}/bin/twistd --nodaemon wormhole-mailbox";
|
|
|
|
WorkingDirectory = dataDir;
|
|
|
|
StateDirectory = baseNameOf dataDir;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-07-09 23:22:56 +01:00
|
|
|
|
|
|
|
meta.maintainers = [ lib.maintainers.mjoerg ];
|
2020-03-30 12:29:30 +01:00
|
|
|
}
|