Luke Granger-Brown
57725ef3ec
git-subtree-dir: third_party/nixpkgs git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
38 lines
902 B
Nix
38 lines
902 B
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
let
|
|
cfg = config.services.magic-wormhole-mailbox-server;
|
|
# keep semicolon in dataDir for backward compatibility
|
|
dataDir = "/var/lib/magic-wormhole-mailbox-server;";
|
|
python = pkgs.python311.withPackages (
|
|
py: with py; [
|
|
magic-wormhole-mailbox-server
|
|
twisted
|
|
]
|
|
);
|
|
in
|
|
{
|
|
options.services.magic-wormhole-mailbox-server = {
|
|
enable = lib.mkEnableOption "Magic Wormhole Mailbox Server";
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
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;
|
|
};
|
|
};
|
|
};
|
|
|
|
meta.maintainers = [ lib.maintainers.mjoerg ];
|
|
}
|