dotfiles/programs/fish.nix

152 lines
4.8 KiB
Nix
Raw Normal View History

2021-12-06 22:35:29 +00:00
{ pkgs, ... }:
{
programs.fish = {
enable = true;
plugins = [
2022-04-27 20:16:55 +00:00
# https://github.com/oh-my-fish/plugin-foreign-env
2021-12-06 22:35:29 +00:00
{
name = "foreign-env";
src = pkgs.fetchFromGitHub {
owner = "oh-my-fish";
repo = "plugin-foreign-env";
2022-04-27 20:16:55 +00:00
rev = "b3dd471bcc885b597c3922e4de836e06415e52dd";
sha256 = "sha256-3h03WQrBZmTXZLkQh1oVyhv6zlyYsSDS7HTHr+7WjY8=";
2021-12-06 22:35:29 +00:00
};
}
2022-04-27 20:16:55 +00:00
# https://github.com/dracula/fish
2021-12-06 22:35:29 +00:00
{
name = "dracula";
src = pkgs.fetchFromGitHub {
owner = "dracula";
repo = "fish";
2022-04-27 20:16:55 +00:00
rev = "62b109f12faab5604f341e8b83460881f94b1550";
sha256 = "sha256-0TlKq2ur2I6Bv7pu7JObrJxV0NbQhydmCuUs6ZdDU1I=";
2021-12-06 22:35:29 +00:00
};
}
2022-01-10 11:28:26 +00:00
2022-03-02 22:31:45 +00:00
{
name = "done-fish";
src = pkgs.fetchFromGitHub {
owner = "nifoc";
repo = "done";
rev = "2f4e94d8306224f63cd12fb992318985a83d51a8";
sha256 = "Pq8HEISGjpCTXBIyukcLUK8r1hJ3/QXAklRCesm4nQ0=";
};
}
2022-04-27 20:16:55 +00:00
# https://github.com/PatrickF1/fzf.fish/releases
2022-01-10 11:28:26 +00:00
{
name = "fzf-fish";
src = pkgs.fetchFromGitHub {
owner = "PatrickF1";
repo = "fzf.fish";
2022-04-27 20:16:55 +00:00
rev = "v8.3";
sha256 = "sha256-eSNUqvKXTxcuvICxo8BmVWL1ESXQuU7VhOl7aONrhwM=";
2022-01-10 11:28:26 +00:00
};
}
2022-04-27 20:16:55 +00:00
# https://github.com/jorgebucaran/autopair.fish/releases
2022-01-10 11:28:26 +00:00
{
name = "autopair-fish";
src = pkgs.fetchFromGitHub {
owner = "jorgebucaran";
repo = "autopair.fish";
rev = "1.0.3";
sha256 = "l6WJ2kjDO/TnU9FSigjxk5xFp90xl68gDfggkE/wrlM=";
};
}
2022-04-27 20:16:55 +00:00
# https://github.com/PatrickF1/colored_man_pages.fish
2022-01-10 11:28:26 +00:00
{
name = "colored_man_pages";
src = pkgs.fetchFromGitHub {
owner = "PatrickF1";
repo = "colored_man_pages.fish";
2022-04-27 20:16:55 +00:00
rev = "4d1766530e3d378b4d273e0fd2700d454f5f54ef";
sha256 = "sha256-hDfyUQpiC5JskdCWOkUUv1CxeVLHNn/o5N2SZhgzvT4=";
2022-01-10 11:28:26 +00:00
};
}
2021-12-06 22:35:29 +00:00
];
shellAliases = {
2022-02-03 22:35:52 +00:00
drsw = "nix-darwin-switch";
2022-02-16 08:36:08 +00:00
upa = "nix flake update ~/.config/nixpkgs -v && upn";
upn = "$HOME/.config/nixpkgs/programs/nvim/update-plugins.sh";
ngc = "nix-collect-garbage -d && sudo nix-collect-garbage -d";
nsr = "sudo nix-store --verify --check-contents --repair";
2021-12-06 22:35:29 +00:00
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";
2022-01-11 22:13:08 +00:00
sshfb = "env TERM=xterm-256color /usr/bin/ssh";
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";
2022-04-14 14:39:35 +00:00
mysqld-direnv-init = "mysql_install_db --user $USER --datadir=$PWD/.direnv/mysql/data --auth-root-authentication-method=normal";
mysqld-direnv = "mysqld --datadir=$PWD/.direnv/mysql/data --bind-address=127.0.0.1 --socket=$PWD/.direnv/mysql/mysqld.sock --gdb";
redis-direnv = "redis-server --dir $PWD/.direnv/redis --bind 127.0.0.1";
2021-12-06 22:35:29 +00:00
};
2021-12-12 18:19:28 +00:00
functions = {
upp = ''
2022-03-19 21:54:55 +00:00
if not test -f ./.envrc; or 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
2022-02-03 22:35:52 +00:00
if [ -z "$__NIX_DARWIN_SET_ENVIRONMENT_DONE" ]
set __nifoc_nix_darwin_set_env (cat /run/current-system/etc/bashrc | grep '-set-environment' | cut -d '.' -f 2)
fenv source "$__nifoc_nix_darwin_set_env"
2021-12-06 22:35:29 +00:00
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
# 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
2022-03-02 22:31:45 +00:00
# Plugin: done
set -g __done_min_cmd_duration 10000
2021-12-06 22:35:29 +00:00
'';
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
};
}