1 { config, lib, pkgs, ... }:
3 cfg = config.services.beanstalkd;
11 services.beanstalkd = {
12 enable = lib.mkEnableOption "the Beanstalk work queue";
16 type = lib.types.port;
17 description = "TCP port that will be used to accept client connections.";
21 address = lib.mkOption {
23 description = "IP address to listen on.";
24 default = "127.0.0.1";
29 openFirewall = lib.mkOption {
30 type = lib.types.bool;
32 description = "Whether to open ports in the firewall for the server.";
39 config = lib.mkIf cfg.enable {
41 networking.firewall = lib.mkIf cfg.openFirewall {
42 allowedTCPPorts = [ cfg.listen.port ];
45 environment.systemPackages = [ pkg ];
47 systemd.services.beanstalkd = {
48 description = "Beanstalk Work Queue";
49 after = [ "network.target" ];
50 wantedBy = [ "multi-user.target" ];
54 ExecStart = "${pkg}/bin/beanstalkd -l ${cfg.listen.address} -p ${toString cfg.listen.port} -b $STATE_DIRECTORY";
55 StateDirectory = "beanstalkd";