System/home-manager/common/programs/core.nix

313 lines
8.8 KiB
Nix
Raw Normal View History

2022-10-02 16:42:53 -04:00
{ config, lib, pkgs, inputs, ... }:
with lib; {
2022-07-02 02:44:43 -04:00
config = mkMerge [
2022-07-03 00:40:04 -04:00
(mkIf config.nathan.programs.util.core {
home.packages = with pkgs; [
# Rust rewrites of common shell utilites
exa
bat
fd
sd
du-dust
ripgrep
ripgrep-all
hyperfine
dogdns
duf
# User friendly cut
choose
# Man but terse
tealdeer
2022-07-03 23:34:12 -04:00
# rsync for _The Cloud_ :tm:
rclone
2022-07-03 00:40:04 -04:00
];
2022-09-05 02:31:37 -04:00
# Configure tmux
programs.tmux = {
enable = true;
aggressiveResize = true;
2022-11-05 17:03:28 -04:00
extraConfig = if pkgs.stdenv.isLinux then ''
2022-09-05 02:31:37 -04:00
set -g default-terminal "tmux-256color"
set -ag terminal-overrides ",xterm-256color:RGB"
2022-10-15 04:57:42 -04:00
set-option -g status-interval 1
set-option -g automatic-rename on
set-option -g automatic-rename-format '#{pane_current_path}: #{pane_current_command}'
2022-11-05 17:03:28 -04:00
'' else ''
set -g default-terminal "screen-256color"
set -ag terminal-overrides ",xterm-256color:RGB"
set-option -g status-interval 1
set-option -g automatic-rename on
set-option -g automatic-rename-format '#{pane_current_path}: #{pane_current_command}'
2022-09-05 02:31:37 -04:00
'';
};
2023-01-27 20:06:22 -05:00
# Configure btop
programs.btop = { enable = true; };
2022-07-03 00:40:04 -04:00
})
(mkIf config.nathan.programs.util.productivity {
home.packages = with pkgs; [
tokei
# Spell check
hunspell
hunspellDicts.en-us
# CLI Markdown renderer
glow
# Command line file manager
broot
# Much better curl
httpie
# CLI spreadsheets
visidata
# Cheatsheet manager
cheat
# Ping with a graph
gping
# Pandoc for documentation
pandoc
2022-08-11 11:25:05 -04:00
# Tmate for pair programming
tmate
2022-07-03 00:40:04 -04:00
];
})
2023-03-11 18:43:11 -05:00
(mkIf (config.nathan.programs.util.git.enable
&& config.nathan.programs.util.git.gpgSign) {
programs.git.signing = {
key = lib.mkDefault "B7A40A5D78C08885";
signByDefault = lib.mkDefault config.nathan.programs.util.git.gpgSign;
};
})
2022-07-02 02:44:43 -04:00
(mkIf config.nathan.programs.util.git.enable {
2022-10-02 16:42:53 -04:00
# Git adjacent packages
home.packages = [
inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}".git-branchless
];
2022-07-02 02:44:43 -04:00
#########################
## Git configuration
#########################
programs.git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
userName = "Nathan McCarty";
userEmail = "nathan@mccarty.io";
signing = {
2023-03-11 18:43:11 -05:00
key = lib.mkDefault "B7A40A5D78C08885";
2022-07-02 02:44:43 -04:00
signByDefault = config.nathan.programs.util.git.gpgSign;
};
ignores = [
"**/*~"
"*~"
"*_archive"
"/auto/"
"auto-save-list"
".cask/"
".dir-locals.el"
"dist/"
"**/.DS_Store"
"*.elc"
"/elpa/"
"/.emacs.desktop"
"/.emacs.desktop.lock"
"/eshell/history"
"/eshell/lastdir"
"flycheck_*.el"
"*_flymake.*"
"/network-security.data"
".org-id-locations"
".persp"
".projectile"
"*.rel"
"/server/"
"tramp"
"\\#*\\#"
];
delta.enable = true;
lfs.enable = true;
extraConfig = {
init = { defaultBranch = "trunk"; };
2022-07-02 02:44:43 -04:00
log = {
showSignature = true;
abbrevCommit = true;
follow = true;
decorate = false;
};
rerere = {
enable = true;
autoupdate = true;
};
merge = {
ff = "only";
conflictstyle = "diff3";
};
push = {
default = "simple";
followTags = true;
};
pull = { rebase = true; };
status = { showUntrackedFiles = "all"; };
transfer = { fsckobjects = true; };
color = { ui = "auto"; };
2022-07-02 02:44:43 -04:00
diff = {
mnemonicPrefix = true;
renames = true;
wordRegex = ".";
submodule = "log";
};
2023-01-27 19:43:17 -05:00
# credential = { helper = "cache"; };
2022-07-02 02:44:43 -04:00
# Disable annoying safe directory nonsense
safe = { directory = "*"; };
2022-06-23 02:57:41 -04:00
};
};
2022-07-02 02:44:43 -04:00
})
(mkIf config.nathan.programs.util.ssh {
#########################
## SSH Configuration
#########################
programs.ssh = {
# SSH configuration
enable = true;
# extra config to set the ciphers
extraConfig = ''
Ciphers aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
'';
2022-08-11 11:25:05 -04:00
# Enable compression
compression = true;
2022-07-02 02:44:43 -04:00
# enable session reuse
controlMaster = "auto";
controlPersist = "10m";
# Configure known hosts
matchBlocks = {
"levitation" = {
forwardAgent = true;
user = "nathan";
hostname = "100.95.223.6";
};
"perception" = {
forwardAgent = true;
user = "nathan";
hostname = "100.67.146.101";
};
"oracles" = {
forwardAgent = true;
user = "nathan";
hostname = "100.66.15.34";
};
"tounge" = {
forwardAgent = true;
user = "nathan";
2022-10-03 02:58:28 -04:00
hostname = "100.75.37.98";
2022-07-02 02:44:43 -04:00
};
"shadowchild" = {
forwardAgent = true;
user = "nathan";
hostname = "172.23.217.149";
};
"matrix.community.rs" = {
forwardAgent = true;
user = "nathan";
hostname = "100.113.74.107";
};
2022-11-23 21:05:37 -05:00
"fusion" = {
forwardAgent = true;
user = "nathan";
hostname = "100.99.69.14";
};
2022-07-02 02:44:43 -04:00
"de1955" = {
user = "de1955";
hostname = "de1955.rsync.net";
};
2022-06-23 02:57:41 -04:00
};
};
2022-07-02 02:44:43 -04:00
})
(mkIf config.nathan.programs.util.fish {
#########################
## Fish Configuration
#########################
programs.fish = {
enable = true;
# Setup our aliases
shellAliases = {
ls = "exa --icons";
la = "exa --icons -a";
lg = "exa --icons --git";
cat = "bat";
dig = "dog";
df = "duf";
2023-01-07 20:43:05 -05:00
idris2 = "rlwrap -s 1000 idris2 --no-banner";
2022-07-02 02:44:43 -04:00
};
# Custom configuration
interactiveShellInit = ''
# Setup any-nix-shell
any-nix-shell fish --info-right | source
# Load logger function
source ~/.config/fish/functions/cmdlogger.fish
2023-01-23 15:12:23 -05:00
# Load up vi keybindings
fish_vi_key_bindings
2022-07-02 02:44:43 -04:00
'';
functions = {
# Setup command logging to ~/.logs
cmdlogger = {
onEvent = "fish_preexec";
body = ''
mkdir -p ~/.logs
echo (date -u +"%Y-%m-%dT%H:%M:%SZ")" "(echo %self)" "(pwd)": "$argv >> ~/.logs/(hostname)-(date "+%Y-%m-%d").log
'';
};
2022-06-23 02:57:41 -04:00
};
2022-07-02 02:44:43 -04:00
};
programs.starship = {
enable = true;
settings = {
directory = {
truncation_length = 3;
fish_style_pwd_dir_length = 1;
};
git_commit = {
commit_hash_length = 6;
only_detached = false;
};
package = { symbol = ""; };
2022-07-02 02:44:43 -04:00
time = {
disabled = false;
format = "[$time]($style)";
time_format = "%I:%M %p";
};
2022-06-23 02:57:41 -04:00
};
};
2022-07-02 15:02:56 -04:00
programs.bat = {
enable = true;
config = {
theme = "zenburn";
style = "header,rule,snip,changes";
};
};
2023-01-23 15:12:23 -05:00
#########################
## Readline + fzf and other quality of life stuff
#########################
programs.readline = {
enable = true;
extraConfig = ''
set editing-mode vi
set show-all-if-ambiguous on
set editing-mode vi
set keymap vi-command
# these are for vi-command mode
"\e[A": history-search-backward
"\e[B": history-search-forward
j: history-search-forward
k: history-search-backward
set keymap vi-insert
# these are for vi-insert mode
"\e[A": history-search-backward
"\e[B": history-search-forward
'';
};
programs.fzf = { enable = true; };
2022-07-02 02:44:43 -04:00
})
(mkIf config.nathan.programs.util.json {
#########################
## JSON Utilities
#########################
programs.jq = { enable = true; };
home.packages = with pkgs; [ jc fx ];
2022-07-02 02:44:43 -04:00
})
];
2022-06-23 02:57:41 -04:00
}