depot/nixos/modules/services/networking/magic-wormhole-mailbox-server.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

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 ];
}