{ config, pkgs, ... }:

{
  # Don't install all programs of the GNOME desktop.
  # https://nixos.wiki/wiki/GNOME#Excluding_some_GNOME_applications_from_the_default_install
  environment.gnome.excludePackages = (with pkgs; [
    gnome-photos
    gnome-tour
    gnome-console # Can't be configured with Home-Manager as of 2023-10.
  ]) ++ (with pkgs.gnome; [
    cheese # Webcam viewer
    gnome-music # Music player
    epiphany # Web browser
    geary # Email
    gnome-characters
    #gnome-contacts
  ]);

  users.users.yoda = {
    packages = with pkgs; [
      # CLI apps
      gnumake # make
      wget
      htop
      killall
      colmena

      # CCC Weather Workshop
      #
      # TODO: rdwd from Git, the packaged version is too old
      #
      # TODO: move to nix shell of weather Git repository
      #       (think of it as a docker container for the weather project: I don't need this elsewhere)
      # https://github.com/nix-community/nix-direnv
      #
      unzip
      (rWrapper.override{ packages = with rPackages; [ lubridate rdwd zoo ]; })

      # Graphical Apps
      gnome.gnome-terminal # Console. For now, we use this instead of gnome-console.
      gnome.gnome-tweaks
      gnome.dconf-editor
      tor-browser-bundle-bin # Tor web browser
      keepassxc # Password manager
      freetube # YouTube client
      tartube-yt-dlp # Video downloader (front-end for yt-dlp)
      joplin-desktop # Markdown notes
      rnote # Handwritten notes
      xournalpp # Handwritte notes
      pdfarranger # PDF files: Split, merge, rotate, rearrange, export selected pages
      # For spellcheck, see here: https://nixos.wiki/wiki/LibreOffice#Spellcheck
      libreoffice-fresh # Office suite
      anki-bin # Flashcards
      signal-desktop # Signal client
      ( # Integrated Development Environment (IDE)
        if (config.nixpkgs.config.allowUnfree)
        then jetbrains.idea-ultimate
        else jetbrains.idea-community
      )
      transmission-gtk # BitTorrent client
      meld # Diff and merge tool
      handbrake # Rip DVD and Blu-ray; rotate and export videos
      mediainfo-gui # View video metadata.

      # Matrix clients
      element-desktop
      #fluffychat
      # Web version: https://app.cinny.in/
      #cinny-desktop
      # E2E encryption is not yet implemented: https://gitlab.gnome.org/GNOME/fractal/-/issues/717
      #fractal
      #nheko
    ];
  };

  # There is a community project providing declarative Flatpak app installations:
  #   https://github.com/GermanBread/declarative-flatpak
  # This is probably a bit overkill for the few Flatpak apps I use.
  # Let's just use the default way:
  #   https://nixos.wiki/wiki/Flatpak
  services.flatpak.enable = true;
  #
  # TODO: These commands have to be executed manually.
  #   flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
  #   flatpak update
  #   # Trim, flip, rotate, crop and export individual clips.
  #   flatpak install io.gitlab.adhami3310.Footage
  #   # Fediverse client. There is also a native client, but it is outdated: https://github.com/GeopJr/Tuba#third-party
  #   flatpak install dev.geopjr.Tuba
}
