- name: Install basic custom void packages
  hosts: interface
  become: true
  tags: interface
  tasks:
    - name: Set up keyd for custom key events
      community.general.xbps:
        name:
          - keyd
        state: "{{ desired_package_state }}"
      notify: installed-keyd

    - name: Install many fonts
      community.general.xbps:
        name: "{{ packages_fonts }}"
        state: "{{ desired_package_state }}"
      notify: installed-fonts
      when: packages_fonts

  handlers:
    - name: Activate keyd service
      ansible.builtin.file:
        force: "yes"
        src: "/etc/sv/{{ item }}"
        dest: "/etc/runit/runsvdir/default/{{ item }}"
        state: link
      with_items: [keyd]
      listen: installed-keyd

    - name: Regenerate fontconfig
      ansible.builtin.command:
        argv:
          - xbps-reconfigure
          - --force
          - fontconfig
      listen: installed-fonts

- name: Install basic custom void packages
  hosts: target_system
  become: true
  tags:
    - packages
  tasks:
    - name: Install a bunch of base custom stuff
      community.general.xbps:
        name: "{{ lookup('community.general.merge_variables', '^packages_.*') }}"
        state: "{{ desired_package_state }}"