<commit_before>{ config, lib, pkgs, ... }:

with lib;

let
  cfg = config.services.beanstalkd;
  pkg = pkgs.beanstalkd;
in

{
  # interface

  options = {
    services.beanstalkd = {
      enable = mkEnableOption "the Beanstalk work queue";

      listen = {
        port = mkOption {
          type = types.int;
          description = "TCP port that will be used to accept client connections.";
          default = 11300;
        };

        address = mkOption {
          type = types.str;
          description = "IP address to listen on.";
          default = "127.0.0.1";
          example = "0.0.0.0";
        };
      };
    };
  };

  # implementation

  config = mkIf cfg.enable {

    environment.systemPackages = [ pkg ];

    systemd.services.beanstalkd = {
      description = "Beanstalk Work Queue";
      after = [ "network.target" ];
      wantedBy = [ "multi-user.target" ];
      serviceConfig = {
        DynamicUser = true;
        Restart = "always";
        ExecStart = "${pkg}/bin/beanstalkd -l ${cfg.listen.address} -p ${toString cfg.listen.port}";
      };
    };

  };
}<commit_msg>nixos/beanstalkd: keep jobs in persistent storage (#73884)<commit_after>{ config, lib, pkgs, ... }:

with lib;

let
  cfg = config.services.beanstalkd;
  pkg = pkgs.beanstalkd;
in

{
  # interface

  options = {
    services.beanstalkd = {
      enable = mkEnableOption "the Beanstalk work queue";

      listen = {
        port = mkOption {
          type = types.int;
          description = "TCP port that will be used to accept client connections.";
          default = 11300;
        };

        address = mkOption {
          type = types.str;
          description = "IP address to listen on.";
          default = "127.0.0.1";
          example = "0.0.0.0";
        };
      };
    };
  };

  # implementation

  config = mkIf cfg.enable {

    environment.systemPackages = [ pkg ];

    systemd.services.beanstalkd = {
      description = "Beanstalk Work Queue";
      after = [ "network.target" ];
      wantedBy = [ "multi-user.target" ];
      serviceConfig = {
        DynamicUser = true;
        Restart = "always";
        ExecStart = "${pkg}/bin/beanstalkd -l ${cfg.listen.address} -p ${toString cfg.listen.port} -b $STATE_DIRECTORY";
        StateDirectory = "beanstalkd";
      };
    };

  };
}
{'fraction_non_alphanumeric': 0.13135228251507322, 'fraction_numerical': 0.015073212747631352, 'mean_word_length': 1.9330808080808082, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6122483', 'n_tokens_mistral': 762, 'n_tokens_neox': 699, 'n_words': 170}