Files
nix/modules/home/nushell/default.nix

108 lines
2.6 KiB
Nix

{
config,
lib,
pkgs,
inputs,
...
}:
let
cfg = config.nushell;
inherit (lib) mkEnableOption mkIf mkOption;
in
{
options.nushell = {
enable = mkEnableOption "nushell";
};
config = mkIf cfg.enable {
home.shell.enableNushellIntegration = true;
programs = {
nushell = {
enable = true;
configFile.text = ''
$env.config.edit_mode = "vi"
$env.config.buffer_editor = "nvim"
$env.config.show_banner = false
$env.EDITOR = "nvim"
$env.config.history.file_format = "sqlite"
$env.config.history.max_size = 5_000_000
$env.config.keybindings = [
{
name: fuzzy_history
modifier: control
keycode: char_r
mode: [emacs, vi_normal, vi_insert]
event: [
{
send: ExecuteHostCommand
cmd: "let result = (
history
| get command
| uniq
| reverse
| str join (char -i 0)
| fzf --scheme=history
--read0
--height=40%
--bind=ctrl-r:toggle-sort
--highlight-line
--query=(commandline | str substring 0..(commandline get-cursor))
+m
| complete
); if ($result.exit_code == 0) { commandline edit ($result.stdout | str trim) }"
}
]
}
];
'';
shellAliases = {
lg = "lazygit";
js = "jj status";
jd = "jj diff";
jn = "jj new";
jf = "jj git fetch";
jp = "jj git push";
};
};
carapace = {
enable = true;
enableNushellIntegration = true;
};
nix-your-shell = {
enable = true;
enableNushellIntegration = true;
};
direnv = {
enable = true;
enableNushellIntegration = true;
nix-direnv.enable = true;
config = {
hide_env_diff = true;
};
};
eza = {
enable = true;
enableNushellIntegration = false;
extraOptions = [ "--group-directories-first" ];
};
starship = {
enable = true;
enableNushellIntegration = true;
settings = {
nodejs.disabled = true;
package.disabled = true;
aws.disabled = true;
python.disabled = true;
};
};
zoxide = {
enableNushellIntegration = true;
};
};
};
}