Polybar configuration. This takes a nix attrset and converts it to the strange data format that polybar uses. Each entry will be converted to a section in the output file. Several things are treated specially: nested keys are converted to dash-separated keys; the special text key is ignored as a nested key, to allow mixing different levels of nesting; and lists are converted to polybar's foo-0, foo-1, ... format.

For example:

"module/volume" = {
  type = "internal/pulseaudio";
  format.volume = "<ramp-volume> <label-volume>";
  label.muted.text = "🔇";
  label.muted.foreground = "#666";
  ramp.volume = ["🔈" "🔉" "🔊"];
  click.right = "pavucontrol &";
}

becomes:

[module/volume]
type=internal/pulseaudio
format-volume=<ramp-volume> <label-volume>
label-muted=🔇
label-muted-foreground=#666
ramp-volume-0=🔈
ramp-volume-1=🔉
ramp-volume-2=🔊
click-right=pavucontrol &
Declarations
Type
attribute set of attribute sets
Default
{ }
Example
{
  "module/volume" = {
    type = "internal/pulseaudio";
    format.volume = "<ramp-volume> <label-volume>";
    label.muted.text = "🔇";
    label.muted.foreground = "#666";
    ramp.volume = ["🔈" "🔉" "🔊"];
    click.right = "pavucontrol &amp;";
  };
}
</label-volume></ramp-volume>