128 lines
3.7 KiB
Nix
Executable file
128 lines
3.7 KiB
Nix
Executable file
{
|
|
host,
|
|
pkgs,
|
|
...
|
|
}: {
|
|
imports = [
|
|
./tmux.nix
|
|
./git.nix
|
|
];
|
|
home = {
|
|
packages = with pkgs; [
|
|
tree
|
|
eza
|
|
bat
|
|
];
|
|
};
|
|
programs.fish = {
|
|
enable = true;
|
|
interactiveShellInit = ''
|
|
set fish_greeting # Disable greeting
|
|
set -U tide_right_prompt_items status\x1ecmd_duration\x1etime
|
|
'';
|
|
shellInit = "
|
|
fish_add_path /usr/local/go/bin
|
|
fish_add_path ~/go/bin
|
|
fish_add_path ~/.local/bin
|
|
set -gx MANPAGER 'nvim +Man!'
|
|
set -gx EDITOR 'nvim'
|
|
set -gx _JAVA_AWT_WM_NONREPARENTING 1
|
|
set -gx NIX_FLAKE '/home/e/dev/nix'
|
|
";
|
|
plugins = [
|
|
{ name = "fzf"; src = pkgs.fishPlugins.fzf-fish.src; }
|
|
{ name = "puffer"; src = pkgs.fishPlugins.puffer.src; }
|
|
];
|
|
functions = {
|
|
nix = {
|
|
wraps = "nix";
|
|
body = ''
|
|
if status is-interactive
|
|
and test (count $argv) = 1 -a "$argv[1]" = develop
|
|
nix develop --command (status fish-path)
|
|
else
|
|
command nix $argv
|
|
end
|
|
'';
|
|
};
|
|
};
|
|
shellAbbrs = {
|
|
g = "git";
|
|
k = "kubectl";
|
|
};
|
|
shellAliases = {
|
|
":q" = "exit";
|
|
hms = "home-manager switch --flake $NIX_FLAKE#${host.username}";
|
|
rbs = "sudo nixos-rebuild switch --flake $NIX_FLAKE#${host.hostName}";
|
|
nvim-dev = "nix run ~/dev/nvim.nix";
|
|
mpv = "mpv --no-keepaspect-window";
|
|
cat = "bat -P";
|
|
tcd = "cd $(mktemp -d)";
|
|
};
|
|
};
|
|
programs.bash = {
|
|
enable = true;
|
|
enableCompletion = true;
|
|
historyControl = ["ignorespace"];
|
|
historyIgnore = [
|
|
":q"
|
|
"exit"
|
|
];
|
|
shellAliases = {
|
|
la = "eza -lahr";
|
|
ll = "la";
|
|
":q" = "exit";
|
|
};
|
|
shellOptions = [
|
|
"cmdhist"
|
|
"globstar"
|
|
"dirspell"
|
|
"dotglob"
|
|
"extglob"
|
|
"cdspell"
|
|
"histappend"
|
|
];
|
|
bashrcExtra = ''
|
|
export PROMPT_COMMAND="prompt_command;history -a"
|
|
export PATH="/usr/local/go/bin:~/go/bin:~/.bin:~/.local/bin:$PATH"
|
|
export EDITOR="nvim"
|
|
[[ $- != *i* ]] && return
|
|
|
|
function prompt_command {
|
|
GIT_BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null | cut -c 1-10)
|
|
[[ $GIT_BRANCH != "" ]] && \
|
|
PS1="\[\033[38;5;1m\][\u@\h\[$(tput sgr0)\] \[$(tput sgr0)\]\[\033[38;5;7m\]\W\[$(tput sgr0)\]\[\033[38;5;1m\]]\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;3m\]($GIT_BRANCH)\[\033[38;5;7m\]\$\[$(tput sgr0)\] " || \
|
|
PS1="\[\033[38;5;1m\][\u@\h\[$(tput sgr0)\] \[$(tput sgr0)\]\[\033[38;5;7m\]\W\[$(tput sgr0)\]\[\033[38;5;1m\]]\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;3m\]\[\033[38;5;7m\]\$\[$(tput sgr0)\] "
|
|
}
|
|
bind "set completion-ignore-case on"
|
|
bind "set completion-map-case on"
|
|
bind "set show-all-if-ambiguous on"
|
|
bind "set menu-complete-display-prefix on"
|
|
bind '"\t":menu-complete'
|
|
bind '"\C-k": previous-history'
|
|
bind '"\C-j": next-history'
|
|
function cd {
|
|
cmd="eza"
|
|
builtin cd "$@" && $cmd
|
|
}
|
|
'';
|
|
initExtra = ''
|
|
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]]
|
|
then
|
|
shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=""
|
|
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
|
|
fi
|
|
'';
|
|
};
|
|
programs.fzf = {
|
|
enable = true;
|
|
historyWidgetOptions = ["--height 60% --preview ''"];
|
|
fileWidgetCommand = "command find -L . -mindepth 1 -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' -prune";
|
|
};
|
|
programs.direnv = {
|
|
enable = true;
|
|
silent = true;
|
|
enableBashIntegration = true;
|
|
nix-direnv.enable = true;
|
|
};
|
|
}
|