feat: set fish as user shell
This commit is contained in:
34
modules/cli/shell/defaultShell.nix
Normal file
34
modules/cli/shell/defaultShell.nix
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
username,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.my.cli.shell;
|
||||
in
|
||||
{
|
||||
options.my.cli.shell.default = lib.mkOption {
|
||||
type = lib.types.enum [
|
||||
"fish"
|
||||
"zsh"
|
||||
];
|
||||
default = "fish";
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf (cfg.default == "fish") {
|
||||
my.cli.shell.fish.enable = true;
|
||||
users.users.${username} = {
|
||||
shell = config.my.hm.programs.fish.package;
|
||||
# do not need `programs.fish.enable = true` since fish is managed by home-manager
|
||||
ignoreShellProgramCheck = true;
|
||||
};
|
||||
})
|
||||
|
||||
(lib.mkIf (cfg.default == "zsh") {
|
||||
my.cli.shell.zsh.enable = true;
|
||||
users.users.${username}.shell = config.my.hm.programs.zsh.package;
|
||||
})
|
||||
];
|
||||
}
|
||||
@@ -53,14 +53,6 @@ lib.my.makeSwitch {
|
||||
nf = "fastfetch";
|
||||
tmux = "tmux -T RGB,focus,overline,mouse,clipboard,usstyle";
|
||||
};
|
||||
|
||||
# https://wiki.nixos.org/wiki/Fish#Setting_fish_as_default_shell
|
||||
initContent = lib.mkBefore ''
|
||||
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" ]]
|
||||
then
|
||||
exec fish -l
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user