Move fish from module directory to module file
This commit is contained in:
182
nix/modules/fish.nix
Normal file
182
nix/modules/fish.nix
Normal file
@@ -0,0 +1,182 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
let tide_conf = builtins.readFile ./tide_config.fish; in
|
||||
{
|
||||
programs.zoxide.enableFishIntegration = true;
|
||||
programs.kitty.shellIntegration.enableFishIntegration = true;
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableFishIntegration = false;
|
||||
};
|
||||
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
settings = {
|
||||
palettes.thoom = {
|
||||
directory_bg = "#3465A4";
|
||||
directory_fg = "#E4E4E4";
|
||||
git_bg = "#4E9A06";
|
||||
git_fg = "#000000";
|
||||
prog_bg = "#212736";
|
||||
prog_fg = "#769ff0";
|
||||
duration_bg = "#C4A000";
|
||||
duration_fg = "#000000";
|
||||
user_bg = "#394260";
|
||||
user_fg = "";
|
||||
time_bg = "#D3D7CF";
|
||||
time_fg = "#000000";
|
||||
prompt_fg = "#00ff00";
|
||||
prompt_bg = "none";
|
||||
};
|
||||
|
||||
palette = "thoom";
|
||||
|
||||
format = lib.concatStrings [
|
||||
"[](fg:directory_bg)"
|
||||
"$directory"
|
||||
"[](fg:directory_bg bg:git_bg)"
|
||||
"$git_branch"
|
||||
"$git_status"
|
||||
"[](fg:git_bg bg:prog_bg)"
|
||||
"$nodejs"
|
||||
"$rust"
|
||||
"[](fg:prog_bg)"
|
||||
"$fill"
|
||||
"[](fg:duration_bg bg:none)"
|
||||
"$cmd_duration"
|
||||
"[](bg:duration_bg fg:user_bg)"
|
||||
"$username"
|
||||
"$hostname"
|
||||
"[](bg:user_bg fg:time_bg)"
|
||||
"$time"
|
||||
"[](fg:time_bg bg: none)"
|
||||
"$line_break"
|
||||
"$character"
|
||||
];
|
||||
|
||||
directory = {
|
||||
style = "fg:directory_fg bg:directory_bg";
|
||||
format = "[ $path( $read_only) ]($style)";
|
||||
truncation_length = 5;
|
||||
truncation_symbol = "…/";
|
||||
substitutions = {
|
||||
"Documents" = "";
|
||||
"Downloads" = "";
|
||||
};
|
||||
};
|
||||
|
||||
git_branch = {
|
||||
symbol = "";
|
||||
style = "fg:git_fg bg:git_bg";
|
||||
format = "[ $symbol $branch ]($style)";
|
||||
};
|
||||
|
||||
git_status = {
|
||||
style = "fg:git_fg bg:git_bg";
|
||||
format = "[($all_status$ahead_behind )]($style)";
|
||||
};
|
||||
|
||||
nodejs = {
|
||||
symbol = "";
|
||||
style = "bg:prog_bg fg:prog_fg";
|
||||
format = "[ $symbol ($version) ]($style)";
|
||||
};
|
||||
|
||||
rust = {
|
||||
symbol = "";
|
||||
style = "fg:prog_fg bg:prog_bg";
|
||||
format = "[ $symbol ($version) ]($style)";
|
||||
};
|
||||
|
||||
cmd_duration = {
|
||||
min_time = 5000; # Show for commands taking > 5 seconds
|
||||
style = "bg:duration_bg fg:duration_fg";
|
||||
format = "[ took $duration ]($style)";
|
||||
};
|
||||
|
||||
username = {
|
||||
show_always = false;
|
||||
style_user = "bg:user_bg";
|
||||
style_root = "bg:user_bg";
|
||||
format = "[ $user@]($style)";
|
||||
disabled = false;
|
||||
};
|
||||
|
||||
hostname = {
|
||||
ssh_only = true;
|
||||
style = "bg:user_bg";
|
||||
format = "[$hostname ]($style)";
|
||||
disabled = false;
|
||||
};
|
||||
|
||||
time = {
|
||||
disabled = false;
|
||||
time_format = "%r";
|
||||
style = "fg:time_fg bg:time_bg";
|
||||
format = "[ $time ]($style)";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
|
||||
plugins = [
|
||||
{
|
||||
# https://github.com/lilyball/nix-env.fish
|
||||
name = "nix-env";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "lilyball";
|
||||
repo = "nix-env.fish";
|
||||
rev = "7b65bd228429e852c8fdfa07601159130a818cfa";
|
||||
sha256 = "sha256-RG/0rfhgq6aEKNZ0XwIqOaZ6K5S4+/Y5EEMnIdtfPhk=";
|
||||
};
|
||||
|
||||
}
|
||||
{
|
||||
# https://github.com/PatrickF1/fzf.fish
|
||||
name = "fzf";
|
||||
src = pkgs.fishPlugins.fzf-fish.src;
|
||||
}
|
||||
];
|
||||
|
||||
shellInit = ''
|
||||
# Undo stupid home-manager behavior of refusing to let the init file be re-sourced
|
||||
set -e __fish_home_manager_config_sourced
|
||||
|
||||
set --universal fish_greeting
|
||||
set -g -x EDITOR "emacsclient -a \"emacs -nw\""
|
||||
set -g -x ALTERNATE_EDITOR "vim"
|
||||
set -g -x TERMINAL "kitty"
|
||||
set -g -x LESS "--ignore-case --QUIET --RAW-CONTROL-CHARS"
|
||||
set -g -x MANPAGER "sh -c 'col -bx | bat -l man -p'"
|
||||
set -g -x MANROFFOPT "-c"
|
||||
set -g -x BAT_THEME "ansi"
|
||||
|
||||
fish_add_path --path ~/.dotfiles/bin ~/.local/bin ~/bin
|
||||
|
||||
# If running under kitty, fake the term for ssh to avoid
|
||||
# having to install terminfo on remote machine
|
||||
function ssh --wraps ssh
|
||||
if test $TERM = xterm-kitty
|
||||
set --function --export TERM xterm-256color
|
||||
end
|
||||
command ssh $argv
|
||||
end
|
||||
|
||||
if test -f $HOME/.cargo/env.fish
|
||||
source "$HOME/.cargo/env.fish"
|
||||
end
|
||||
|
||||
if test -f $HOME/.local.fish
|
||||
source $HOME/.local.fish
|
||||
end
|
||||
'';
|
||||
|
||||
shellAliases = {
|
||||
ec = "emacsclient -n --alternate-editor=\"emacs -nw\"";
|
||||
src = "source $HOME/.config/fish/config.fish";
|
||||
pubip = "curl icanhazip.com";
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user