nixconf/modules/home/core/default.nix
2024-01-23 01:39:26 -05:00

252 lines
6.3 KiB
Nix

{
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
]) ++ (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.browserpass.enable = lib.mkDefault (cfg.private && cfg.graphical);
programs.firefox = {
enable = cfg.graphical;
profiles.default.extensions = (with pkgs.nur.repos.rycee.firefox-addons;
[ browserpass adnauseam ]
);
};
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";
};
}