nixos/home/modules/fish.nix

47 lines
1.3 KiB
Nix
Raw Normal View History

2024-05-29 21:54:42 -07:00
{ pkgs, inputs, config, lib, ... }:
2024-05-29 23:34:10 -07:00
2024-05-29 21:54:42 -07:00
let
cfg = config.snowhawk.fish;
2024-07-21 12:41:21 -07:00
macos = config.snowhawk.macos.enable;
2024-05-29 21:54:42 -07:00
in
2024-02-28 20:52:51 -08:00
{
2024-05-29 21:54:42 -07:00
options.snowhawk.fish = {
enable = lib.mkEnableOption "fish";
2024-05-29 16:03:39 -07:00
};
2024-05-29 23:34:10 -07:00
2024-05-29 21:54:42 -07:00
config = lib.mkIf cfg.enable {
2024-07-21 12:41:21 -07:00
programs.bash = lib.mkIf (!macos) {
2024-05-29 21:54:42 -07:00
enable = true;
initExtra = ''
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]]
then
shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=""
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
fi
'';
};
2024-05-29 16:03:39 -07:00
2024-07-21 12:41:21 -07:00
programs.zsh = lib.mkIf macos {
2024-07-21 12:26:22 -07:00
enable = true;
initExtra = ''
if [[ $(${pkgs.procps}/bin/ps $(${pkgs.procps}/bin/ps -p $$ -co "ppid=") -co "comm=") != "fish" && -z ''${BASH_EXECUTION_STRING} ]]
then
# shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION=""
# exec ${pkgs.fish}/bin/fish $LOGIN_OPTION
exec ${pkgs.fish}/bin/fish
fi
'';
};
2024-05-29 21:54:42 -07:00
programs.fish = {
enable = true;
2024-06-30 16:27:31 -07:00
shellAbbrs = {
copy = "xclip -sel clip";
};
2024-05-29 21:54:42 -07:00
interactiveShellInit =
builtins.readFile "${inputs.fish_theme}/fish_prompt.fish" + "\n" +
2024-06-30 16:27:31 -07:00
builtins.readFile ../fish/config.fish;
2024-05-29 21:54:42 -07:00
};
2024-02-28 20:52:51 -08:00
};
}