nixcfg/modules/home/cli-apps/fish/default.nix

61 lines
1.6 KiB
Nix
Raw Normal View History

2024-03-21 15:00:36 +01:00
{ lib
, config
, pkgs
, ...
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.metacfg.cli-apps.fish;
in
{
options.metacfg.cli-apps.fish = {
enable = mkEnableOption "FISH shell";
};
config = mkIf cfg.enable {
programs.fish = {
enable = true;
interactiveShellInit = ''
function msh --wraps mosh --description 'mosh with tmux'
if not set -q argv[1]
echo 'Usage: msh [user@]host [command]'
else
${pkgs.mosh}/bin/mosh $argv -- tmux new-session -A -s 0
end
end
function tsh --wraps ssh --description 'ssh with tmux'
if not set -q argv[1]
echo 'Usage: tsh [user@]host [command]'
else
${pkgs.openssh}/bin/ssh -t $argv -- tmux new-session -A -s 0
end
end
'';
plugins = [{
name = "foreign-env";
src = pkgs.fetchFromGitHub {
owner = "oh-my-fish";
repo = "plugin-foreign-env";
rev = "dddd9213272a0ab848d474d0cbde12ad034e65bc";
sha256 = "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs";
};
}];
# shellInit =
# ''
# # nix
# 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
#
# # home-manager
# if test -e $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
# fenv source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
# end
# '';
};
};
}