{ inputs, config, pkgs, ... }:
  let
    userName = "nate";
    fullName = "Nate Anderson";
    email = "nate.anderson@vasion.com";
    unstable = import inputs.nixpkgs-unstable { system = "x86_64-linux"; config.allowUnfree = true; };
    # oldstable = import inputs.nixpkgs-23 { system = "x86_64-linux"; config.allowUnfree = true; };
    # davinciDesktop = pkgs.makeDesktopItem {
    #   name = "davinci-resolve-studio";
    #   desktopName = "Davinci Resolve Studio";
    #   exec = "${oldstable.davinci-resolve-studio}";
    # };
    # overlay-unstable = final: prev: {
    #   unstable = inputs.nixpkgs-unstable.legacyPackages.x86_64-linux;
    # };
    # overlay-oldstable = final: prev: {
    #   pkgs23 = inputs.nixpkgs-23.legacyPackages.x86_64-linux;
    # };
    # overlay-unstable = final: prev: {
    #   # unstable = inputs.nixpkgs-unstable.legacyPackages.x86_64-linux;
    #   unstable = import inputs.nixpkgs-unstable {
    #     system = "x86_64-linux";
    #     config = { 
    #       allowUnfreePredicate = (pkg: true); 
    #       allowUnfree = true; 
    #     }; 
    #   };
    # };
  in
{
  # nixpkgs.overlays = [
  #   overlay-unstable
  # ];

  imports = [
      ../../../shared/modules/apps/firefox/firefox.nix
      ../hypr/hypr_home.nix
  ];

  catppuccin = {
    enable = true;
    flavor = "macchiato";
    accent = "lavender";
    cursors.enable = false;
    kvantum.enable = true;
    zsh-syntax-highlighting.enable = true;
    mako.enable = false;
  };

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

  programs.home-manager.enable = true;

  # The home.packages option allows you to install Nix packages into your
  # environment.
  firefoxApp.enable = true;
  
  fonts.fontconfig.enable = true;

  hyprhome = {
    enable = true;
    homePackages = with pkgs; [
      chromium
      #
      # Dev Tools
      #
      helix
      unstable.distrobox
      unstable.docker_25
      docker-compose
      jq
      gnumake
      mariadb
      lsp-ai
      python3
      cmake
      unstable.claude-code
      # proto
      protobuf
      protoc-gen-dart
      # Go stuff
      go
      delve
      gotools
      go-tools
      govulncheck
      unstable.golangci-lint
      go-swag
      delve
      trivy

      # clojure
      jre17_minimal
      clojure
      clojure-lsp
      cljfmt
      leiningen
      emacs

      ### LSP's
      gopls
      nil
      typescript-language-server
      nodePackages_latest.bash-language-server
      openscad-lsp
      vscode-langservers-extracted # provides eslint, markdown, json, css, and html lsp
      python311Packages.python-lsp-server
      yaml-language-server
      elixir-ls
      ltex-ls

      ### Misc
      usbutils
      openscad
      libxml2
      nfs-utils
      # For AnyConnect VPN
      openconnect
      networkmanager-openconnect

      #
      # Better Unix
      #
      bat
      duf
      du-dust
      fd
      fzf
      lsd
      lsof
      ripgrep
      tre-command
      gtop
      htop
      neofetch
      s-tui
      openapi-tui
      tasktimer
      # Normies
      unzip
      llpp
      nmap

      #
      # Photo / Video
      #
      imv
      mpv
      ffmpeg
      tenacity
      yt-dlp
      libimobiledevice
      ifuse
      simple-scan

      #
      # Communication
      #
      mumble

      #
      # Other
      #
      keepassxc
      obs-studio
      prusa-slicer
      gnome-disk-utility
      kdePackages.filelight
      hugo
      unstable.llama-cpp
      unstable.davinci-resolve-studio

      #
      # Style
      #
      catppuccin-gtk
      catppuccin-kvantum
      libsForQt5.qtstyleplugin-kvantum
      libsForQt5.qt5ct
      kdePackages.qtstyleplugin-kvantum
      kdePackages.qt6ct
      # Install fonts
      lato
      unstable.nerd-fonts.hurmit
      unstable.nerd-fonts.overpass
      unstable.nerd-fonts.monaspace
      monaspace
    ];
  };

  home.file."${config.xdg.configHome}" = {
    source = ../../dotfiles;
    recursive = true;
  };

  # enable saving ssh secrets (needed for go mod installing private packages)
  services.gnome-keyring.enable = true;
  services.gnome-keyring.components = [ "ssh" "secrets" ];
  # Enable bluetooth headphone controls
  services.mpris-proxy.enable = true;

  home.sessionVariables = {
    # BAT_THEME="Catppuccin Macchiato";
    EDITOR = "hx";
    XCURSOR_THEME = "Bibata-Modern-Classic";
    XCURSOR_SIZE = "24";
    HYPRCURSOR_THEME = "Bibata-Modern-Classic";
  };

  # Git setup
  programs.git = {
      enable = true;
      userEmail = email;
      userName = fullName;
      extraConfig = {
        include = { path = "${config.xdg.configHome}/macchiato.gitconfig"; };
        init = { defaultBranch = "main"; };
        merge = { conflictStyle="zdiff3"; };
        pull = { ff = "only"; };
        push = { autoSetupRemote="true"; };
        # Vasion rewrite rule
        url = {
          "git@github.com:" = {
            insteadOf = "https://github.com/";
          };
        };
      };
      delta = {
        enable = true;
        options = {
          side-by-side = true;
          hyperlinks = true;
        };
      };

  };

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

    bash.enable = true;
  };

  # Zsh setup
  programs.zsh = {
      enable = true;
      oh-my-zsh = {
          enable = true;
          plugins = [ "git" "ssh-agent" ];
          theme = "half-life";
          extraConfig =
          ''
            zstyle :omz:plugins:ssh-agent lazy yes
          '';
      };
      initContent = ''
          # direnv setup
          eval "$(direnv hook zsh)"

          # History
          HISTSIZE=10000
          SAVEHIST=10000
          setopt SHARE_HISTORY
          setopt APPEND_HISTORY

          # Work envs
          source ~/.vasion_env
          # bonus functions
          source ~/.config/zsh_functions.zsh

          export GOBIN=~/go/bin
          export PATH=$PATH:$GOBIN
          export NIX_SHELL=/usr/bin/env zsh

          
          claudew() {
            export ANTHROPIC_MODEL=us.anthropic.claude-sonnet-4-20250514-v1:0
            export CLAUDE_CODE_USE_BEDROCK=1
            export AWS_REGION=us-west-2
            export CLAUDE_CONFIG_DIR=/home/nate/.claude-work
            claude
          }
          claudep() {
            unset ANTHROPIC_MODEL
            unset CLAUDE_CODE_USE_BEDROCK
            unset AWS_REGION
            export CLAUDE_CONFIG_DIR=/home/nate/.claude-personal
            claude
          }
          '';
      shellAliases = {
          ls="lsd";
          l="lsd --almost-all --long";
          llm="lsd --timesort --long";
          lS="lsd --oneline --classic";
          lt="lsd --tree --depth=2";
          cat="bat --paging=never";
          ccat="cat";
          catp="bat --paging=never -p";
          catplain="bat --paging=never -p";
          rm="rm -i";
      };
      syntaxHighlighting = {
        enable = true;
      };
  };

  qt = {
    enable = true;
    platformTheme.name = "kvantum";
    style = {
      name = "kvantum";
      package = pkgs.catppuccin-kvantum.override {
        accent = "lavender";
        variant = "macchiato";
      };
    };
  };

  gtk = {
    enable = true;
    # icons
    iconTheme = {
      package = pkgs.catppuccin-papirus-folders;
      name = "Papirus-Dark";
    };
    # gtk theme
    theme = {
      name = "catppuccin-macchiato-lavender-compact+rimless";
      package = pkgs.catppuccin-gtk.override {
        accents = [ "lavender" ];
        size = "compact";
        tweaks = [ "rimless" ];
        variant = "macchiato";
      };
    };
    # cursor defined in hypr-home.nix
  };

  xdg.configFile = {
    "helix".source = config.lib.file.mkOutOfStoreSymlink "/home/nate/nixos/shared/dotfiles/helix";
    "waybar".source = config.lib.file.mkOutOfStoreSymlink "/home/nate/nixos/nate-work/linked-dotfiles/waybar";
    "gtk-4.0/assets".source = "${config.gtk.theme.package}/share/themes/${config.gtk.theme.name}/gtk-4.0/assets";
    "gtk-4.0/gtk.css".source = "${config.gtk.theme.package}/share/themes/${config.gtk.theme.name}/gtk-4.0/gtk.css";
    "gtk-4.0/gtk-dark.css".source = "${config.gtk.theme.package}/share/themes/${config.gtk.theme.name}/gtk-4.0/gtk-dark.css";
    "Kvantum/kvantum.kvconfig".source = (pkgs.formats.ini {}).generate "kvantum.kvconfig" {
      General.theme = "catppuccin-macchiato-lavender";
     };
  };
  # home.file.".icons/default/index.theme".text = ''
  #   [icon theme]
  #   Inherits=Catppuccin-Macchiato-Lavender-Cursors
  # '';

  home.stateVersion = "23.11"; # Please read the comment before changing.
}
