{ config, pkgs, ... }:

{
  imports = [
    ./plasma.nix
  ];

  home = {
    username = "chase";
    homeDirectory = "/home/chase";
    preferXdgDirectories = true;
    stateVersion = "24.11";
    file = {
      "scripts" = {
	    source = config.lib.file.mkOutOfStoreSymlink ./scripts;
	    recursive = true;
      };
    };
    sessionPath = [
      "$HOME/scripts"
    ];
    shellAliases = {
      gs = "git status";
      "..." = "cd ../..";
    };
  };

  xdg = {
    enable = true;
	userDirs.enable = true;
	configFile = {
	  "emacs/early-init.el" = {
	    source = config.lib.file.mkOutOfStoreSymlink ./emacs/early-init.el;
      };
	  "emacs/init.el" = {
	    source = config.lib.file.mkOutOfStoreSymlink ./emacs/init.el;
      };
	};
  };

  catppuccin = {
    enable = true;
    flavor = "mocha";
  };

  programs.bash = {
    enable = true;
	enableCompletion = true;
	bashrcExtra = ''
      export SSH_AUTH_SOCK=/home/chase/.bitwarden-ssh-agent.sock
    '';
	historyIgnore = [
	  "ls"
	  "cd"
	  "exit"
    ];
  };

  programs.emacs = {
    enable = true;
    package = pkgs.emacs-pgtk;
  };

  programs.fastfetch = {
    enable = true;
	settings = {
	  logo = {
	    source = "nixos_small";
      };
	  display = {
	    size = {
		  binaryPrefix = "si";
		};
		color = "blue";
		separator = ": ";
      };
	  modules = [
	    "title"
		"separator"
	    "os"
		"host"
		"uptime"
		"kernel"
		"packages"
		"lm"
		"de"
		"wm"
		"shell"
		"terminal"
		"terminalfont"
		{
		  key = "Display";
		  type = "display";
		}
		"cpu"
		"gpu"
		"memory"
		"swap"
		"disk"
		"datetime"
		"colors"
		"break"
		"player"
		"media"
      ];
	};
  };

  programs.firefox = {
    enable = true;
    nativeMessagingHosts = [ pkgs.firefoxpwa ];
    profiles = {
      default = {
        id = 0;
	    name = "default";
	    isDefault = true;
	    extensions = {
	      packages = with pkgs.nur.repos.rycee.firefox-addons; [
	        awesome-rss
	        betterttv
	        bitwarden
	        clearurls
	        control-panel-for-twitter
	        enhancer-for-youtube
	        facebook-container
	        flagfox
	        istilldontcareaboutcookies
	        privacy-badger
	        return-youtube-dislikes
	        search-by-image
	        sponsorblock
	        tab-session-manager
	        tampermonkey
	        ublock-origin
	      ];
	    };
    	settings = {
      	  "browser.formfill.enable" = false;
		  "browser.ml.chat.enabled" = false;
		  "browser.ml.chat.shortcuts" = false;
		  "browser.ml.chat.sidebar" = false;
		  "browser.newtabpage.activity-stream.feeds.section.topstories" = false;
      	  "browser.newtabpage.activity-stream.feeds.snippets" = false;
      	  "browser.newtabpage.activity-stream.section.highlights.includeBookmarks" = false;
      	  "browser.newtabpage.activity-stream.section.highlights.includeDownloads" = false;
      	  "browser.newtabpage.activity-stream.section.highlights.includePocket" = false;
      	  "browser.newtabpage.activity-stream.section.highlights.includeVisited" = false;
      	  "browser.newtabpage.activity-stream.showSponsored" = false;
      	  "browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
      	  "browser.newtabpage.activity-stream.system.showSponsored" = false;
      	  "browser.topsites.contile.enabled" = false;
      	  "browser.urlbar.unitConversion.enabled" = true;
		  "extensions.formautofill.addresses.enabled" = false;
		  "extensions.formautofill.creditCards.enabled" = false;
       	  "extensions.pocket.enabled" = false;
		  "general.autoScroll" = true;
      	  "widget.use-xdg-desktop-portal.file-picker" = 1;
      	  "signon.rememberSignons" = false;
    	};
	    search = {
	      force = true;
	      default = "SearX";
	      order = [ "SearX" "google" ];
	      engines = {
	        "Nix Packages" = {
	          urls = [{
	            template = "https://search.nixos.org/packages";
		        params = [
		          { name = "type"; value = "packages"; }
		          { name = "query"; value = "{searchTerms}"; }
		        ];
	          }];
	          icon = "''${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
	          definedAliases = [ "@np" ];
	        };
	        "SearX" = {
	          urls = [{ template = "https://searx.traphouse.cathoderaytube.net/?q={searchTerms}"; }];
	          definedAliases = [ "@searx" ];
	        };
	        "bing".metaData.hidden = true;
	      };
        };
      };
    };
  };

  programs.ghostty = {
    enable = true;
	enableBashIntegration = true;
	installVimSyntax = true;
	settings = {
	  font-family = "BlexMono Nerd Font";
	  font-size = 11;
	};
  };
  
  programs.git = {
    enable = true;
    userName = "chase";
    userEmail = "chase@cathoderaytube.net";
	extraConfig = {
      init.defaultBranch = "main";
	};
  };

  programs.git-credential-oauth.enable = true;

  programs.htop.enable = true;

  programs.mpv = {
    enable = true;
	config = {
	  profile = "gpu-hq";
	  ytdl-format = "bestvideo+bestaudio";
    };
	scripts = [
	  pkgs.mpvScripts.mpris
    ];
  };

  programs.obs-studio.enable = true;

  programs.ranger.enable = true;

  programs.rmpc.enable = true;

  programs.texlive.enable = true;

  programs.yazi = {
    enable = true;
	enableBashIntegration = true;
  };

  programs.yt-dlp = {
    enable = true;
	settings = {
	  embed-thumbnail = true;
    };
  };

  home.packages = with pkgs; [
    anki-bin
    audacity
	ffmpeg
	fortune
	gimp
	ibm-plex
	imagemagick
	kdePackages.kdenlive
	libnotify
	libreoffice
    logiops
    lolcat
	nerd-fonts.blex-mono
    picard
	protonmail-bridge
	thunderbird
	ueberzugpp
	vcv-rack
    runelite
  ];

  services.emacs = {
    enable = true;
    client = {
      enable = true;
      arguments = [
        "-c"
        "-a ''"
        "-n"
      ];
    };
    defaultEditor = true;
  };

  services.mpd = {
    enable = true;
	extraConfig = ''
	  audio_output {
	    type "pipewire"
		name "Pipewire Output"
      }
    '';
	musicDirectory = "/mnt/share/media/music";
  };

  services.mpd-mpris = {
    enable = true;
	mpd.useLocal = true;
  };

}
