1
0
Fork 0
dotfiles/programs/fish.nix

119 lines
3.5 KiB
Nix
Raw Normal View History

2021-12-06 22:35:29 +00:00
{ pkgs, ... }:
{
programs.fish = {
enable = true;
plugins = [
{
name = "foreign-env";
src = pkgs.fetchFromGitHub {
owner = "oh-my-fish";
repo = "plugin-foreign-env";
rev = "dddd9213272a0ab848d474d0cbde12ad034e65bc";
sha256 = "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs";
};
}
{
name = "dracula";
src = pkgs.fetchFromGitHub {
owner = "dracula";
repo = "fish";
rev = "28db361b55bb49dbfd7a679ebec9140be8c2d593";
sha256 = "vdqYlEyYvlPVgTkwXbE8GVZo0UBBT88JyMSWYykhfx4=";
};
}
];
shellAliases = {
hmsw = "home-manager switch --flake ~/.config/nixpkgs/#$USER";
j = "z";
ji = "zi";
la = "exa --long --all --group --header --group-directories-first --sort=type --icons";
lg = "exa --long --all --group --header --git";
lt = "exa --long --all --group --header --tree --level ";
2021-12-29 23:55:41 +00:00
docker = "podman";
2021-12-12 18:19:28 +00:00
ytdl = "ytdl_with_options";
ytdl_mp4 = "ytdl_with_options -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]'";
yti = "ytdl_with_options -F";
upa = "nix flake update ~/.config/nixpkgs -v";
2021-12-06 22:35:29 +00:00
upn = "$HOME/.config/nixpkgs/programs/nvim/update-plugins.sh";
2022-01-05 10:07:09 +00:00
ucl = "nix-collect-garbage -d && nix-store --gc && nix-store --optimise -v && calculate-nix-path";
2021-12-06 22:35:29 +00:00
};
2021-12-12 18:19:28 +00:00
functions = {
upp = ''
2021-12-29 23:55:41 +00:00
if rg --quiet '^use flake$' ./.envrc
nix flake update ./ -v
else
2021-12-29 23:55:41 +00:00
nix flake update (rg --no-line-number --color never '^use flake' ./.envrc | cut -d ' ' -f 3 | xargs -I {} sh -c 'echo {}') -v
end
'';
2021-12-12 18:19:28 +00:00
wget-browser = ''
set user_agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15"
wget -U "$user_agent" $argv
'';
2021-12-29 23:55:41 +00:00
aria-browser = ''
set user_agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15"
aria2c -U "$user_agent" --file-allocation none -x 2 $argv
'';
2021-12-12 18:19:28 +00:00
ytdl_with_options = ''
2022-01-01 00:06:58 +00:00
yt-dlp --config-location "$HOME/.config/yt-dlp/config" --download-archive "$HOME/.config/yt-dlp/archive" $argv
2021-12-12 18:19:28 +00:00
'';
};
2021-12-06 22:35:29 +00:00
shellInit = ''
2021-12-27 20:24:11 +00:00
# Disable greeting
set fish_greeting
if test -e "$HOME/.cache/fish/nix_path_value"
set -gx NIX_PATH (cat "$HOME/.cache/fish/nix_path_value")
end
2021-12-06 22:35:29 +00:00
if test -e /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
fenv source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
end
2022-01-05 09:52:59 +00:00
if test -d "$HOME/.bin"
set -gx PATH "$HOME/.bin" $PATH
2021-12-06 22:35:29 +00:00
end
2021-12-15 19:44:02 +00:00
for app_path in \
"/Applications/Little Snitch.app/Contents/Components" \
"/Applications/Wireshark.app/Contents/MacOS" \
"/usr/local/MacGPG2/bin"
if test -d "$app_path"
set -gx PATH $PATH "$app_path"
end
end
2021-12-06 22:35:29 +00:00
# Vendor Configuration
2021-12-27 20:24:11 +00:00
for vendor_conf in \
"$HOME/.nix-profile/share/fish/vendor_conf.d/direnv.fish"
if test -f "$vendor_conf"
2021-12-06 22:35:29 +00:00
source "$vendor_conf"
end
end
# Custom Scripts
if test -d "$HOME/.config/fish/custom-scripts"
for custom_script in $HOME/.config/fish/custom-scripts/*.fish
source "$custom_script"
end
end
'';
2021-12-14 19:33:07 +00:00
interactiveShellInit = ''
if [ "$TERM" = "xterm-kitty" ]
alias ssh "kitty +kitten ssh"
end
'';
2021-12-06 22:35:29 +00:00
};
}