{ lib
, config
, pkgs
, ...
}:

with lib;
let
  cfg = config.my.profiles.desktop;
in
{
  options.my.profiles.desktop.enable = mkEnableOption "desktop profile";

  config = mkIf cfg.enable {
    my = {
      yubikey = {
        enable = mkDefault true;
        luksSupport = {
          enable = mkDefault true;
          devices = mkDefault [ "enc" ];
        };
      };
      wallpapers.enable = mkDefault true;
      theming = {
        enable = mkDefault true;
        scheme = mkDefault "catppuccin-macchiato";
      };
      virtualisation.podman.enable = mkDefault true;

      programs = {
        chromium.enable = mkDefault true;
        firefox.enable = mkDefault true;
        gpg.enable = mkDefault true;
        hyprland.enable = mkDefault true;
        logseq.enable = mkDefault true;
        nix-edit.enable = mkDefault true;
        nvim.enable = mkDefault true;
        python.versions."311".enable = mkDefault true;
        spotify.enable = mkDefault true;
        ssh.enable = mkDefault true;
        thunar.enable = mkDefault true;
        wallpaper.enable = mkDefault true;
        zathura.enable = mkDefault true;
      };
      services = {
        dunst.enable = mkDefault true;
        gammastep.enable = true;
        kdeconnect.enable = mkDefault true;
        printing.enable = true;
        wireguard.enable = true;
      };
    };

    environment.systemPackages = with pkgs; [
      anki
      calibre
      fd
      keepassxc
      nixpkgs-review
      pavucontrol
      stable.libreoffice # NOTE breaks often
      stable.signal-desktop # NOTE breaks often
      stable.texlive.combined.scheme-full # NOTE breaks often
      thunderbird
      vlc
    ];

    programs.nix-ld.enable = true;

    home-manager.users.moritz = {
      services.nextcloud-client = {
        enable = true;
        startInBackground = true;
      };
    };
    services = {
      illum.enable = true;
      gnome.gnome-keyring.enable = true;
      pipewire = {
        enable = true;
        alsa.enable = true;
        pulse.enable = true;
      };
    };
  };
}
