flake/modules/home/terminal/nushell.nix
2026-03-06 17:49:33 +00:00

71 lines
1.4 KiB
Nix

{
pkgs,
lib,
config,
...
}: let
cfg = config.mods.terminal;
aliases = {
la = "ls -la";
".." = "cd ..";
"..." = "cd ../..";
"...." = "cd ../../..";
"....." = "cd ../../../..";
"......" = "cd ../../../../..";
};
in {
options.mods.terminal.nushell.enable = lib.mkEnableOption "enables nushell";
config = lib.mkIf cfg.nushell.enable {
programs.nushell = {
enable = true;
shellAliases = aliases;
# vi mode + sensible defaults
extraConfig = ''
$env.config = {
show_banner: false
edit_mode: vi
cursor_shape: {
vi_insert: line
vi_normal: block
}
history: {
max_size: 2097152
sync_on_enter: true
file_format: "sqlite"
isolation: false
}
completions: {
case_sensitive: false
quick: true
partial: true
algorithm: "fuzzy"
}
table: {
mode: rounded
}
}
'';
# Carry over zsh session variables
extraEnv = lib.optionalString config.mods.terminal.development.enable ''
$env.EDITOR = "nvim"
'';
};
# Starship prompt (same as zsh)
programs.starship.enable = true;
# direnv nushell integration
programs.direnv = lib.mkIf config.mods.terminal.development.enable {
enableNushellIntegration = true;
};
};
}