{ config, lib, pkgs, ... }: let cfg = config.my.home.shell; swayEnabled = config.my.home.wm.windowManager == "sway"; aliases = config.my.home.shell.aliases; in { config = lib.mkIf (cfg.name == "fish") { programs.fish = { enable = true; shellAliases = aliases; interactiveShellInit = '' set fish_greeting # Tmux on terminal start, unless we're in a SSH connection if status is-interactive if test -z "$SSH_CONNECTION" if not tmux has-session 2>/dev/null; or test -z "$TMUX" exec tmux new-session -A -s 0 end end end # I don't know why I need to do this, but otherwise I can't # build rust packages with `cargo build' if it's not set ... set -Ux PKG_CONFIG_PATH "${pkgs.openssl.dev}/lib/pkgconfig" ''; loginShellInit = lib.mkIf swayEnabled '' if test -z "$DISPLAY"; and test (tty) = "/dev/tty1" exec sway end ''; }; xdg.configFile."fish/functions" = { source = ./functions; recursive = true; }; }; }