{ config, pkgs, lib, ... }: let inherit (lib) types; cfg = config.mtxyz; in { options.mtxyz = { private = lib.mkOption { type = types.bool; default = false; }; minimal = lib.mkOption { type = types.bool; default = false; }; graphical= lib.mkOption { type = types.bool; default = true; }; }; config = { home.packages = with pkgs; ([ delta unzip tree pwgen nvd nixpkgs-fmt kitty.terminfo nix-output-monitor mosh universal-ctags ] ++ (lib.optionals cfg.graphical [ xclip wl-clipboard neovide vlc helvum freetube slack armcord logseq zoom-us fractal ]) ++ (lib.optionals (cfg.graphical && !cfg.minimal) [ ungoogled-chromium reaper cardinal plex-media-player puredata minetest prismlauncher mangohud qflipper bottles dosbox blender ]) ++ (lib.optionals cfg.private [ hledger hledger-ui diceware libsecret ]) ++ (lib.optionals (cfg.private && cfg.graphical) [ thunderbird ])); accounts = lib.mkIf cfg.private { email.accounts.mtxyz = rec { address = "me@mtxyz.me"; userName = address; passwordCommand = "${pkgs.libsecret}/bin/secret-tool lookup login ${address}"; realName = "mtxyz"; primary = true; aliases = [ "me@mtxyz.me" "billy@mtxyz.me" "billie@mtxyz.me" "bailey@mtxyz.me" "contact@wasv.me" ]; imap = { host = "imap.migadu.com"; port = 993; tls.enable = true; }; smtp = { host = "smtp.migadu.com"; port = 465; tls.enable = true; }; folders = { inbox = "INBOX"; trash = "Archives"; }; }; calendar.accounts.home = { name = "Home"; primary = true; remote = rec { type = "caldav"; userName = "me@mtxyz.me"; passwordCommand = ["${pkgs.libsecret}/bin/secret-tool" "lookup" "login" userName]; url = "https://cdav.migadu.com/calendars/${userName}/home/"; }; }; }; manual.html.enable = true; home.keyboard.layout = "us"; home.keyboard.options = [ "caps:super" ]; programs.tmux = { enable = true; mouse = true; aggressiveResize = true; clock24 = true; newSession = true; extraConfig = '' bind - split-window -h -c "#{pane_current_path}" bind | split-window -v -c "#{pane_current_path}" unbind '"' unbind % bind -n M-Left select-pane -L bind -n M-Right select-pane -R bind -n M-Up select-pane -U bind -n M-Down select-pane -D set -sg escape-time 0 ''; }; programs.btop = { enable = true; settings = { color_theme = "TTY"; theme_background = false; }; }; programs.password-store.enable = lib.mkDefault cfg.private; programs.password-store.package = pkgs.pass.withExtensions (exts: [ exts.pass-otp ]); services.syncthing.enable = lib.mkDefault cfg.private; programs.firefox = { enable = cfg.graphical; nativeMessagingHosts = with pkgs; lib.optionals cfg.private [ browserpass ]; policies = { BlockAboutConfig = true; }; profiles.default = { extensions = (with pkgs.nur.repos.rycee.firefox-addons; [ browserpass adnauseam pay-by-privacy libredirect unpaywall ]); settings = { "browser.fixup.domainsuffixwhitelist.lan" = true; }; search = { force = true; default = "DuckDuckGo Start"; engines = { "Nix Packages" = { urls = [{ template = "https://search.nixos.org/packages"; params = [ { name = "type"; value = "packages"; } { name = "channel"; value = "unstable"; } { name = "query"; value = "{searchTerms}"; } ]; }]; icon = "''${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; definedAliases = [ "@np" ]; }; "Nix Options" = { urls = [{ template = "https://search.nixos.org/options"; params = [ { name = "channel"; value = "unstable"; } { name = "query"; value = "{searchTerms}"; } ]; }]; icon = "''${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; definedAliases = [ "@no" ]; }; "NixOS Wiki" = { urls = [{ template = "https://nixos.wiki/index.php"; params = [ { name = "search"; value = "{searchTerms}"; } ]; }]; iconUpdateURL = "https://nixos.wiki/favicon.png"; updateInterval = 24 * 60 * 60 * 1000; # every day definedAliases = [ "@nw" ]; }; "DuckDuckGo Start" = { urls = [{ template = "https://duckduckgo.com/"; params = [ { name = "start"; value = "1"; } { name = "q"; value = "{searchTerms}"; } ]; }]; iconUpdateURL = "https://duckduckgo.com/favicon.png"; definedAliases = [ "@ddg" ]; }; "GitHub" = { urls = [{ template = "https://github.com/search"; params = [ { name = "ref"; value = "opensearch"; } { name = "q"; value = "{searchTerms}"; } ]; }]; iconUpdateURL = "https://github.com/favicon.ico"; definedAliases = [ "@gh" ]; }; "Bing".metaData.hidden = true; "Google".metaData.hidden = true; "DuckDuckGo".metaData.hidden = true; "Amazon.com".metaData.hidden = true; "eBay".metaData.hidden = true; }; }; }; }; programs.wezterm = { enable = cfg.graphical; extraConfig = (builtins.readFile ./wezterm.lua); }; programs.direnv = { enable = true; nix-direnv.enable = true; }; programs.zoxide = { enable = true; enableFishIntegration = true; options = [ "--cmd cd" ]; }; programs.fish = { enable = true; functions = { fish_prompt = (builtins.readFile ./fish_prompt.fish); fish_greeting = ""; last_cmd = "echo $history[1]"; fish_command_not_found = '' set -l last_argv $argv echo \"$argv[1]\" Command Not Found ''; wezssh = '' set -l host $argv[1] setsid wezterm cli spawn --domain-name SSH:"$host" 1>&2 2>/dev/null ''; }; interactiveShellInit = '' abbr --position anywhere -a !! -f last_cmd ''; }; programs.gpg.enable = true; services.gpg-agent = { enable = true; defaultCacheTtl = 1800; pinentryFlavor = if cfg.graphical then "gnome3" else "tty"; }; programs.bat.enable = true; programs.lazygit.enable = true; programs.git = { enable = true; userName = "Bailey Stevens"; userEmail = "me@mtxyz.me"; package = pkgs.gitFull; aliases = { lazy = "!lazygit"; graph = "log --graph --oneline"; }; extraConfig = { pull.rebase = true; rebase.autostash = true; init.defaultBranch = "main"; push.autoSetupRemote = true; sendemail.confirm = "always"; sendemail.identity = "mtxyz"; credential.helper = "libsecret"; }; ignores = [ "*~" "*.swp" ".cache/" ".venv/" "compile_commands.json" ".#*" "tags" ".vscode/" ".gradle" ".idea" ".direnv" ".envrc" ]; delta.enable = true; delta.options.line-numbers = true; }; programs.ssh = { enable = true; controlMaster = "auto"; controlPersist = "5m"; matchBlocks = { "jellydonut sol pegasi gallifrey" = { forwardAgent = true; hostname = "%h.gg.lan"; }; "freedom shell" = { user = "wasv"; forwardAgent = true; hostname = "%h.csh.rit.edu"; }; }; }; programs.fzf.enable = true; programs.zellij = { enable = true; settings = { pane_frames = false; default_mode = "locked"; default_layout = "compact"; }; }; programs.home-manager.enable = true; home.stateVersion = "22.11"; }; }