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

###### interface
let
  inherit (pkgs.lib) mkOption;

  uid = (import ../system/ids.nix).uids.pulseaudio;
  gid = (import ../system/ids.nix).gids.pulseaudio;

  options = {
    services = {
      pulseaudio = {
        enable = mkOption {
          default = false;
          description = ''
            Whether to enable the PulseAudio system-wide audio server.
            Note that the documentation recommends running PulseAudio
            daemons per-user rather than system-wide on desktop machines.
          '';
        };

        logLevel = mkOption {
          default = "notice";
          example = "debug";
          description = ''
            A string denoting the log level: one of
            <literal>error</literal>, <literal>warn</literal>,
            <literal>notice</literal>, <literal>info</literal>,
            or <literal>debug</literal>.
          '';
        };
      };
    };
  };
in

###### implementation

# For some reason, PulseAudio wants UID == GID.
assert uid == gid;

{
  require = [
    options
  ];

  environment = {

    extraPackages =
      pkgs.lib.optional
        (!config.environment.cleanStart)
        pkgs.pulseaudio;
  };

  users = {
    extraUsers = [
      { name = "pulse";
        inherit uid;
        group = "pulse";
        description = "PulseAudio system-wide daemon";
        home = "/var/run/pulse";
      }
    ];

    extraGroups = [
      { name = "pulse";
        inherit gid;<commit_msg>PulseAudio Upstart job: honor `enable'.<commit_after>{pkgs, config, ...}:

###### interface
let
  inherit (pkgs.lib) mkOption mkIf;

  uid = (import ../system/ids.nix).uids.pulseaudio;
  gid = (import ../system/ids.nix).gids.pulseaudio;

  options = {
    services = {
      pulseaudio = {
        enable = mkOption {
          default = false;
          description = ''
            Whether to enable the PulseAudio system-wide audio server.
            Note that the documentation recommends running PulseAudio
            daemons per-user rather than system-wide on desktop machines.
          '';
        };

        logLevel = mkOption {
          default = "notice";
          example = "debug";
          description = ''
            A string denoting the log level: one of
            <literal>error</literal>, <literal>warn</literal>,
            <literal>notice</literal>, <literal>info</literal>,
            or <literal>debug</literal>.
          '';
        };
      };
    };
  };
in

###### implementation

# For some reason, PulseAudio wants UID == GID.
assert uid == gid;

mkIf config.services.pulseaudio.enable {
  require = [
    options
  ];

  environment = {

    extraPackages =
      pkgs.lib.optional
        (!config.environment.cleanStart)
        pkgs.pulseaudio;
  };

  users = {
    extraUsers = [
      { name = "pulse";
        inherit uid;
        group = "pulse";
        description = "PulseAudio system-wide daemon";
        home = "/var/run/pulse";
      }
    ];

    extraGroups = [
      { name = "pulse";
        inherit gid;
{'fraction_non_alphanumeric': 0.12695822454308095, 'fraction_numerical': 0.0, 'mean_word_length': 1.8432282003710576, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '6316144', 'n_tokens_mistral': 904, 'n_tokens_neox': 857, 'n_words': 212}