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

165 lines
4.6 KiB
Nix

{ config, lib, pkgs, inputs, ... }:
with lib; {
config = mkMerge [
(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
xcp
# User friendly cut
choose
# Man but terse
tealdeer
# rsync for _The Cloud_ :tm:
rclone
];
# Configure tmux
programs.tmux = {
enable = true;
aggressiveResize = true;
extraConfig = if pkgs.stdenv.isLinux then ''
set -g default-terminal "tmux-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}'
'' 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}'
'';
};
# Configure btop
programs.btop = { enable = true; };
})
(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
# Tmate for pair programming
tmate
];
})
(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";
idris2 = "rlwrap -s 1000 idris2 --no-banner";
};
# Custom configuration
interactiveShellInit = ''
# Setup any-nix-shell
any-nix-shell fish --info-right | source
# Load logger function
source ~/.config/fish/functions/cmdlogger.fish
# Load up vi keybindings
fish_vi_key_bindings
'';
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
'';
};
};
};
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 = ""; };
time = {
disabled = false;
format = "[$time]($style)";
time_format = "%I:%M %p";
};
};
};
programs.bat = {
enable = true;
config = {
theme = "zenburn";
style = "header,rule,snip,changes";
};
};
#########################
## 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; };
})
(mkIf config.nathan.programs.util.json {
#########################
## JSON Utilities
#########################
programs.jq = { enable = true; };
home.packages = with pkgs; [ jc fx ];
})
];
}