115 lines
3.3 KiB
Nix
115 lines
3.3 KiB
Nix
{ 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.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/IlanCosman/tide
|
|
name = "tide";
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "IlanCosman";
|
|
repo = "tide";
|
|
rev = "13fa55ef109009e04e6e5fabda0d0e662b4e6315";
|
|
sha256 = "sha256-+6LdcFLqDzUcCmBoKO4LDH5+5odqVqUb1NmEVNMEMjs=";
|
|
};
|
|
}
|
|
{
|
|
# https://github.com/PatrickF1/fzf.fish
|
|
name = "fzf";
|
|
src = pkgs.fishPlugins.fzf-fish.src;
|
|
}
|
|
];
|
|
|
|
shellInit = ''
|
|
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
|
|
|
|
function mkenv --description "Initialize a devenv environment or configure its .envrc"
|
|
argparse --name=mkenv h/here -- $argv
|
|
or return 1 # Exit if parsing fails
|
|
|
|
# Default target directory is the current directory.
|
|
set -l target_dir "."
|
|
|
|
# Check if we are inside a Git repository's working tree.
|
|
if git rev-parse --is-inside-work-tree >/dev/null 2>&1
|
|
if not set -q _flag_here; and not test -f devenv.nix
|
|
set target_dir (git rev-parse --show-toplevel)
|
|
end
|
|
end
|
|
|
|
pushd "$target_dir"
|
|
|
|
# Check for the existence of the primary devenv configuration file.
|
|
if not test -f "devenv.nix"
|
|
devenv init
|
|
else
|
|
# If devenv.nix exists, check for the direnv configuration file.
|
|
if not test -f ".envrc"
|
|
echo 'eval "$(devenv direnvrc)"' > .envrc
|
|
direnv allow
|
|
end
|
|
end
|
|
|
|
if test -f "devenv.nix"
|
|
emacsclient devenv.nix
|
|
else
|
|
echo -e "\e[31mCould not open devenv.nix as it was not created.\e[0m"
|
|
end
|
|
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
|
|
|
|
${builtins.readFile ./tide_config.fish}
|
|
'';
|
|
|
|
shellAliases = {
|
|
ec = "emacsclient -n --alternate-editor=\"emacs -nw\"";
|
|
pubip = "curl icanhazip.com";
|
|
};
|
|
};
|
|
}
|