reorganise /homes

This commit is contained in:
do butterflies cry? 2026-03-22 12:26:35 +10:00
parent 719bd1de6b
commit 85071855ec
Signed by: cry
GPG key ID: F68745A836CA0412
32 changed files with 219 additions and 1031 deletions

109
homes/modules/cli/bat.nix Executable file
View file

@ -0,0 +1,109 @@
let
# Module Meta Configuration
setShellAliases = true;
supportBash = true;
supportZsh = true;
supportFish = true;
in
{
osConfig,
config,
pkgs,
lib,
username,
...
}: let
inherit
(builtins)
elemAt
;
inherit
(lib)
flip
mkIf
optional
splitString
;
cfg = config.programs.bat;
# NOTE: `<derivation>.pname` can be used instead of `<derivation>.meta.mainProgram`
# NOTE: but then `pkgs.bash` would return `"bash-interactive"` which is annoying...
shellPkg = osConfig.users.users.${username}.shell;
shell = shellPkg.meta.mainProgram;
pager =
cfg.config.pager
|> splitString " "
|> flip elemAt 0;
in {
programs.bat = {
enable = true;
config = {
# WARNING: pager must be set for this module to function
# NOTE: not sure whether to use ov/moor/viddy as my pager?
pager = "less -FR";
# theme = "Dracula";
};
};
home = {
shellAliases = mkIf setShellAliases {
bat = "prettybat";
cat = "prettybat";
diff = "batdiff";
brg = "batgrep";
man = "batman";
# watch = "batwatch"; # NOTE: using viddy instead atm
};
sessionVariables = {
PAGER = pager;
# REF: https://github.com/eth-p/bat-extras/blob/master/doc/batpipe.md
BATPIPE_ENABLE_COLOR = "true";
BATPIPE_INSIDE_LESS = "true";
BATPIPE_TERM_WIDTH = "-"; # hyphone -> auto detect
};
packages = with pkgs.bat-extras;
[
batdiff
batgrep
batman
batpipe
batwatch
prettybat
]
++ (with pkgs; [
bat
entr # required by pkgs.bat-extras.batwatch
ripgrep # required by pkgs.bat-extras.batgrep
delta # required by pkgs.bat-extras.batdiff
])
++ optional (pkgs?${pager}) pkgs.${pager};
};
# Configure the user's shell to source batpipe
# WARNING: only currently supports bash, zsh, & fish
programs = {
bash = mkIf (supportBash || shell == "bash") {
initExtra = ''
eval "$(batpipe)"
'';
};
zsh = mkIf (supportZsh || shell == "zsh") {
initContent = ''
eval "$(batpipe)"
'';
};
fish = mkIf (supportFish || shell == "fish") {
interactiveShellInit = ''
eval (batpipe)
'';
};
};
}

View file

@ -0,0 +1,79 @@
{config, ...}: {
programs.btop = {
enable = true;
settings = {
# Theming
color_theme = "dracula";
theme_background = true;
truecolor = true;
force_tty = false;
vim_keys = false; # allow vim keybindings
# Units
clock_format = "%I:%M %p, %b %d";
temp_scale = "celsius";
base_10_sizes = false; # use KB or KiB
# UI
background_update = true;
update_ms = 100;
rounded_corners = false;
graph_symbol = "braille"; # braille/block/tty
graph_symbol_cpu = "default";
graph_symbol_mem = "default";
graph_symbol_net = "default";
graph_symbol_proc = "default";
# Processes Window
proc_left = true; # show on left side of window
proc_colors = true;
proc_gradient = true;
proc_per_core = false; # false: % of ALL cores
proc_mem_bytes = false; # show mem usage as %
proc_sorting = "cpu lazy";
proc_filter_kernel = false; # hide kernel child processes
proc_tree = false;
# CPU Window
cpu_bottom = false; # display at bottom of window
show_uptime = true;
show_cpu_freq = true;
check_temp = true; # show cpu temp
show_coretemp = true; # show temp per core
cpu_graph_upper = "total"; # upper graph shows total CPU usage
cpu_graph_lower = "user"; # lower graph shows user's CPU usage
cpu_invert_lower = true;
cpu_single_graph = false; # disable lower graph
show_gpu_info = "Off"; # Auto/On/Off
gpu_mirror_graph = false; # horizontally mirror gpu graph
# Memory Window
mem_below_net = false; # show below net window
mem_graphs = true; # show graphs not meters
show_swap = true; # show swap memory usage
# Disks Subwindow
show_disks = true; # split mem box to show disk info
swap_disk = true; # show swap memory as disk
show_io_stat = true;
io_graph_combined = false; # combine read/write stats
io_mode = true; # show io stat as graph
use_fstab = true; # read disk list from /etc/fstab
only_physical = false; # ignore non-physical disks
# Network Window
net_iface = ""; # default network interface to monitor
net_auto = true; # overrides net_download/net_upload (below)
net_sync = false; # sync download/upload graph scales
net_download = 100; # max download speed graphed
net_upload = 100; # max upload speed graphed
# Battery
show_battery = true;
selected_battery = "Auto";
show_battery_watts = true;
# Other
log_level = "WARNING"; # ERROR/WARNING/INFO/DEBUG
};
};
}

View file

@ -0,0 +1,22 @@
{...}: {
programs.hyfetch = {
enable = true;
settings = {
backend = "neofetch";
args = null;
distro = null;
preset = "transfeminine"; # "nonbinary";
pride_month_disable = false;
custom_ascii_path = null;
mode = "rgb";
light_dark = "dark";
auto_detect_light_dark = true;
lightness = 0.65;
color_align = {
mode = "horizontal";
};
};
};
}

View file

@ -0,0 +1,5 @@
{...}: {
programs.tmux = {
enable = true;
};
}