top @ { config
, pkgs
, username
, inputs
, ...
}: {
  imports = [
    inputs.nixvim.homeModules.nixvim
    inputs.catppuccin.homeModules.catppuccin
    inputs.spicetify-nix.homeManagerModules.default
    ./nixvim
  ];

  #NOTE: MUST be kept up to date with nixpkgs!
  home.stateVersion = "25.11";

  home.username = username;
  home.homeDirectory = "/home/${username}";

  home.packages = with pkgs; [
    mpv
    feh
    grim
    slurp
    xdg-user-dirs
    hyprpicker
    libqalculate
    btop
    xfce.thunar
    prismlauncher
    playerctl
    signal-desktop
    qbittorrent
    unzip
  ];

  catppuccin.enable = true;

  gtk = {
    enable = true;
    colorScheme = "dark";
    font.name = "JetBrainsMono";
  };

  wayland.windowManager.hyprland = {
    enable = true;
    settings = (import ./hyprland/settings.nix) top;
  };

  programs.zathura.enable = true;

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

  programs.zoxide = {
    enable = true;
    enableZshIntegration = true;
    options = [
      "--cmd cd"
    ];
  };

  programs.spicetify =
    let
      spkgs = inputs.spicetify-nix.legacyPackages.${pkgs.stdenv.hostPlatform.system};
    in
    {
      enable = true;
      enabledExtensions = with spkgs.extensions; [
        fullAppDisplay
        shuffle
        aiBandBlocker
      ];
      enabledCustomApps = with spkgs.apps; [
        newReleases
      ];
      theme = spkgs.themes.catppuccin;
      colorScheme = "mocha";
    };

  programs.vesktop.enable = true;

  programs.rofi = {
    enable = true;
    modes = [
      "combi"
      "drun"
      "calc"
      "ssh"
    ];
    plugins = [
      pkgs.rofi-calc
    ];
  };
  programs.zsh = {
    enable = true;
    # For automatic login
    profileExtra = ''
      if [ -z "$WAYLAND_DISPLAY" ] && [ "$XDG_VTNR" = 1 ]; then
      	exec hyprland
      fi
    '';

    autocd = true;
    enableCompletion = true;
    autosuggestion.enable = true;
    syntaxHighlighting.enable = true;
    initContent = pkgs.lib.mkBefore ''
      		date
      # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
      # Initialization code that may require console input (password prompts, [y/n]
      # confirmations, etc.) must go above this block; everything else may go below.
      if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then
        source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh"
      fi
    '';
    plugins = [
      {
        name = "powerlevel10k";
        src = "${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/";
        file = "powerlevel10k.zsh-theme";
      }
      {
        name = "p10k-config";
        src = ./p10k;
        file = "p10k.zsh";
      }
    ];

    oh-my-zsh = {
      enable = true;
      plugins = [
        "git"
      ];
      theme = "robbyrussell";
    };
  };

  programs.fzf = {
    enable = true;
    enableZshIntegration = true;
  };

  programs.kitty = {
    enable = true;
    enableGitIntegration = true;
    font = {
      name = "JetBrains Mono";
      size = 10;
    };
    shellIntegration.enableZshIntegration = true;
    #TODO: kitty config
  };

  programs.git = {
    enable = true;
    settings.user = {
      email = "weckyy702@gmail.com";
      name = "Weckyy702";
    };
    #TODO: signing
  };

  services.hyprpaper = {
    enable = true;
    settings =
      let
        # TODO: this should be done more cleanly
        wallpaper_path = ./hyprland/horizontal_16x9.png;
      in
      {
        preload = "${wallpaper_path}";
        wallpaper = [
          #TODO: this should be dynamic
          "DP-1,${wallpaper_path}"
          "HDMI-A-1,${wallpaper_path}"
        ];
      };
  };

  services.dunst.enable = true;

  services.hyprpolkitagent.enable = true;

  services.ssh-agent = {
    enable = true;
    enableZshIntegration = true;
  };
}
