---
- name: Install repositories on Fedora
  become: true
  when: ansible_distribution == "Fedora"
  block:
    - name: Install RPMFusion repositories
      ansible.builtin.dnf:
        name:
          - https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-{{ ansible_distribution_major_version }}.noarch.rpm
          - https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-{{ ansible_distribution_major_version }}.noarch.rpm
        state: present
        disable_gpg_check: true

    - name: Install Docker CE repository
      ansible.builtin.yum_repository:
        name: docker-ce-stable
        description: Docker CE Stable - $basearch
        baseurl: https://download.docker.com/linux/fedora/$releasever/$basearch/stable
        enabled: true
        gpgcheck: true
        gpgkey: https://download.docker.com/linux/fedora/gpg

    - name: Install VSCode repository
      ansible.builtin.yum_repository:
        name: vscode
        description: Visual Studio Code
        baseurl: https://packages.microsoft.com/yumrepos/vscode
        enabled: true
        gpgcheck: true
        gpgkey: https://packages.microsoft.com/keys/microsoft.asc

    - name: Enable Signal-Desktop COPR repository
      community.general.copr:
        name: luminoso/Signal-Desktop
        state: enabled

- name: Install packages on Fedora
  become: true
  when: ansible_distribution == "Fedora"
  ansible.builtin.dnf:
    name:
      - arc-theme
      - cmake
      - code  # visual studio code
      - deluge
      - docker-ce
      - gcc
      - gcc-c++
      - gnome-tweaks
      - gnome-shell-extension-material-shell
      - gnome-shell-extension-openweather
      - gnome-shell-extension-system-monitor-applet
      - gnome-shell-extension-vertical-overview
      - gnupg2
      - guvcview
      - java-17-openjdk
      - jq
      - libffi-devel
      - libvirt
      - libvirt-devel
      - libxml2-devel
      - mediawriter
      - ncurses-devel
      - NetworkManager-tui
      - pinta
      - powerline
      - python27
      - python36
      - python37
      - python38
      - python39
      - python310
      - ShellCheck
      - signal-desktop
      - steam
      - systemd-devel
      - texlive-fontawesome5
      - texlive-roboto
      - texlive-scheme-tetex
      - texlive-sourcesanspro
      - virt-manager
      - vlc
      - xclip
      - yarnpkg
    state: present

- name: Install unsigned packages on Fedora
  when: ansible_distribution == "Fedora"
  become: true
  ansible.builtin.dnf:
    name:
      # draw.io/diagrams.net
      - https://github.com/jgraph/drawio-desktop/releases/download/v17.4.2/drawio-x86_64-17.4.2.rpm
      # zoom
      - https://zoom.us/client/latest/zoom_x86_64.rpm
    state: present
    disable_gpg_check: true

- ansible.builtin.import_tasks: install_mpw.yml
- ansible.builtin.import_tasks: install_nvm.yml
- ansible.builtin.import_tasks: install_pipx.yml
- ansible.builtin.import_tasks: install_poetry.yml
- ansible.builtin.import_tasks: install_postman.yml
- ansible.builtin.import_tasks: install_rustup.yml
- ansible.builtin.import_tasks: install_typora.yml

# It is now day eight hundred and thirty nine of begging the ansible devs to let
# me loop over blocks. pls bcoca i have a family
- name: Install Tor Browser
  ansible.builtin.include_tasks:
    file: install_tor_browser.yml
  loop: "{{ _local_human_users }}"
  loop_control:
    loop_var: local_username

- name: Install MultiMC
  ansible.builtin.include_tasks:
    file: install_multimc.yml
  loop: "{{ _local_human_users }}"
  loop_control:
    loop_var: local_username
