{ inputs, pkgs, ... }:
let
  claude-code    = inputs.claude-code.packages.${pkgs.stdenv.hostPlatform.system}.default;
  pkgs-unstable  = inputs.nixpkgs-unstable.legacyPackages.${pkgs.stdenv.hostPlatform.system};
in {
  home.packages = with pkgs; [
    firefox
    google-chrome
    kitty
    claude-code
    mpv
    obsidian
    pavucontrol
  ];

  xdg.mimeApps = {
    enable = true;
    defaultApplications = {
      "text/html"                = "firefox.desktop";
      "application/xhtml+xml"    = "firefox.desktop";
      "x-scheme-handler/http"    = "firefox.desktop";
      "x-scheme-handler/https"   = "firefox.desktop";
      "x-scheme-handler/about"   = "firefox.desktop";
      "x-scheme-handler/unknown" = "firefox.desktop";
      "x-scheme-handler/ftp"     = "firefox.desktop";
      "application/pdf"          = "firefox.desktop";

      "inode/directory"          = "org.kde.dolphin.desktop";

      "application/zip"              = "org.kde.ark.desktop";
      "application/x-7z-compressed"  = "org.kde.ark.desktop";
      "application/vnd.rar"          = "org.kde.ark.desktop";
      "application/x-rar-compressed" = "org.kde.ark.desktop";
      "application/x-tar"            = "org.kde.ark.desktop";
      "application/x-compressed-tar" = "org.kde.ark.desktop";
      "application/gzip"             = "org.kde.ark.desktop";
      "application/x-bzip2"          = "org.kde.ark.desktop";
      "application/x-xz"             = "org.kde.ark.desktop";
      "application/zstd"             = "org.kde.ark.desktop";

      "image/png"     = "org.kde.gwenview.desktop";
      "image/jpeg"    = "org.kde.gwenview.desktop";
      "image/gif"     = "org.kde.gwenview.desktop";
      "image/webp"    = "org.kde.gwenview.desktop";
      "image/bmp"     = "org.kde.gwenview.desktop";
      "image/tiff"    = "org.kde.gwenview.desktop";
      "image/avif"    = "org.kde.gwenview.desktop";
      "image/svg+xml" = "org.kde.gwenview.desktop";

      "video/mp4"          = "mpv.desktop";
      "video/x-matroska"   = "mpv.desktop";
      "video/webm"         = "mpv.desktop";
      "video/quicktime"    = "mpv.desktop";
      "video/x-msvideo"    = "mpv.desktop";
      "video/mpeg"         = "mpv.desktop";

      "audio/mpeg"  = "mpv.desktop";
      "audio/flac"  = "mpv.desktop";
      "audio/x-wav" = "mpv.desktop";
      "audio/ogg"   = "mpv.desktop";
      "audio/mp4"   = "mpv.desktop";
    };
  };

  # Symlinks in ~/.jdks/ - path scanned by IntelliJ on Linux by default
  # After rebuild: File > Project Structure > SDKs > Detect SDKs
  home.file = {
    ".jdks/jdk-8".source  = "${pkgs-unstable.openjdk8}/lib/openjdk";
    ".jdks/jdk-11".source = "${pkgs-unstable.openjdk11}/lib/openjdk";
    ".jdks/jdk-17".source = "${pkgs-unstable.openjdk17}/lib/openjdk";
    ".jdks/jdk-21".source = "${pkgs-unstable.openjdk21}/lib/openjdk";
  };

  home.sessionVariables = {
    TERMINAL = "kitty";
    XDG_TERMINAL_EMULATOR = "kitty";
  }; 

  programs.zsh = {
    enable = true;
    enableCompletion = true;
    autosuggestion.enable = true;
    syntaxHighlighting.enable = true;

    history = {
      size = 10000;
      path = "$HOME/.zsh_history";
    };

    setOptions = [
      "HIST_IGNORE_ALL_DUPS"
      "AUTO_CD"
    ];
    initContent = ''
      source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme
      [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
    '';
    oh-my-zsh = {
      enable = true;
      plugins = [
        "git"
        "dirhistory"
        "history"
      ];
    };
  }; 

  programs.direnv = {
    enable = true;
    nix-direnv.enable = true;
    enableBashIntegration = true;
    enableZshIntegration = true;
  };
}
