2022-06-17 18:38:11 -04:00
|
|
|
{ config, pkgs, lib, ... }:
|
2022-05-16 19:54:35 -04:00
|
|
|
|
|
|
|
{
|
2022-06-17 18:38:11 -04:00
|
|
|
options.nathans-home.fish = with lib; {
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
2022-05-16 19:54:35 -04:00
|
|
|
};
|
|
|
|
};
|
2022-06-17 18:38:11 -04:00
|
|
|
config = lib.mkIf config.nathans-home.fish.enable {
|
|
|
|
## Shell
|
|
|
|
# Shell proper
|
|
|
|
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";
|
2022-05-16 19:54:35 -04:00
|
|
|
};
|
2022-06-17 18:38:11 -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
|
|
|
|
'';
|
|
|
|
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-05-16 19:54:35 -04:00
|
|
|
};
|
2022-06-17 18:38:11 -04:00
|
|
|
};
|
|
|
|
# Starship, for the prompt
|
|
|
|
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";
|
|
|
|
};
|
2022-05-16 19:54:35 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|