bash ~ zsh wip
This commit is contained in:
20
modules/shell/config.nix
Normal file
20
modules/shell/config.nix
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.my.shell.type = lib.mkOption {
|
||||
type = lib.types.enum [
|
||||
"bash"
|
||||
"zsh"
|
||||
];
|
||||
default = "bash";
|
||||
description = "The shell to use system-wide (bash or zsh)";
|
||||
};
|
||||
config = {
|
||||
users.users.jawz.shell = pkgs.${config.my.shell.type};
|
||||
programs.zsh.enable = config.my.shell.type == "zsh";
|
||||
};
|
||||
}
|
||||
@@ -5,6 +5,9 @@
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
shellType = config.my.shell.type;
|
||||
in
|
||||
{
|
||||
options.my.shell.tools.enable = lib.mkEnableOption "shell tools and utilities";
|
||||
config = lib.mkIf config.my.shell.tools.enable {
|
||||
@@ -16,15 +19,10 @@
|
||||
};
|
||||
zoxide = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
enableBashIntegration = shellType == "bash";
|
||||
enableZshIntegration = shellType == "zsh";
|
||||
};
|
||||
bash = {
|
||||
initExtra = ''
|
||||
if command -v fzf-share >/dev/null; then
|
||||
source "$(fzf-share)/key-bindings.bash"
|
||||
source "$(fzf-share)/completion.bash"
|
||||
fi
|
||||
'';
|
||||
${shellType} = {
|
||||
shellAliases = {
|
||||
cd = "z";
|
||||
hh = "hstr";
|
||||
@@ -37,7 +35,27 @@
|
||||
tr '[:upper:]' '[:lower:]' | sort |
|
||||
uniq --count | sort -rn'';
|
||||
};
|
||||
};
|
||||
}
|
||||
// (
|
||||
if shellType == "bash" then
|
||||
{
|
||||
initExtra = ''
|
||||
if command -v fzf-share >/dev/null; then
|
||||
source "$(fzf-share)/key-bindings.bash"
|
||||
source "$(fzf-share)/completion.bash"
|
||||
fi
|
||||
'';
|
||||
}
|
||||
else
|
||||
{
|
||||
initContent = ''
|
||||
if command -v fzf-share >/dev/null; then
|
||||
source "$(fzf-share)/key-bindings.bash"
|
||||
source "$(fzf-share)/completion.bash"
|
||||
fi
|
||||
'';
|
||||
}
|
||||
);
|
||||
bat = {
|
||||
enable = true;
|
||||
config.pager = "less -FR";
|
||||
|
||||
Reference in New Issue
Block a user