From e1a2780a0a53c009e0396eff9c3be7d29e4d7c24 Mon Sep 17 00:00:00 2001 From: wi11-holdsworth <83637728+wi11-holdsworth@users.noreply.github.com> Date: Wed, 13 Aug 2025 23:51:01 +1000 Subject: [PATCH] set fish as default login shell via workaround --- hosts/server/configuration.nix | 1 - modules/home-manager/features/fish.nix | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/hosts/server/configuration.nix b/hosts/server/configuration.nix index 1a395c4..dfc2220 100644 --- a/hosts/server/configuration.nix +++ b/hosts/server/configuration.nix @@ -34,7 +34,6 @@ ]; home = "/home/srv"; isNormalUser = true; - shell = pkgs.fish; }; }; diff --git a/modules/home-manager/features/fish.nix b/modules/home-manager/features/fish.nix index d80d2ed..3c31aaf 100644 --- a/modules/home-manager/features/fish.nix +++ b/modules/home-manager/features/fish.nix @@ -1,4 +1,9 @@ -{ config, lib, ... }: +{ + config, + lib, + pkgs, + ... +}: let feature = "fish"; in @@ -22,6 +27,18 @@ in vim = "nvim"; }; }; + + # https://nixos.wiki/wiki/Fish#Setting_fish_as_your_shell + programs.bash = { + 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 + ''; + }; }; imports = [ ];