nixos-config/modules/home/shell-conf/nushell/nushell.nix

73 lines
2 KiB
Nix

{ config, lib, pkgs, ... }:
{
home.packages = with pkgs; [
nu_scripts
];
programs.nushell = {
enable = true;
shellAliases = {
"ls" = "ls -m";
"ll" = "ls -m";
"la" = "ls -am";
"lz" = "eza -l";
"lza" = "eza -al";
"y" = "job spawn { wezterm --config-file ~/.config/wezterm/launcher.lua start --always-new-process --cwd (pwd) yazi }";
};
configFile.source = ./config.nu;
loginFile.text = ''
${pkgs.figlet}/bin/figlet -f ($env.HOME)/.local/share/flf/wavy.flf (hostname)
'';
environmentVariables = {
ENV_CONVERSIONS.PATH = {
from_string = lib.hm.nushell.mkNushellInline "{|s| $s | split row (char esep) }";
to_string = lib.hm.nushell.mkNushellInline "{|v| $v | str join (char esep) }";
};
};
settings = {
show_banner = false;
ls = { clickable_links = true; };
table = {
mode = "rounded";
header_on_separator = true;
};
color_config = {
hints = "#666666";
separator = "#333333";
};
completions = {
case_sensitive = false;
quick = true;
partial = true;
algorithm = "fuzzy";
external = {
enable = true;
max_results = 200;
};
};
};
extraEnv = ''
let fish_completer = {|spans|
let completions = fish --command $'complete "--do-complete=($spans | str join " ")"'
| from tsv --flexible --noheaders --no-infer
| rename value description
let has_paths = ($completions | any {|row| $row.value =~ '/' or $row.value =~ '\\.\\w+$' or $row.value =~ ' '})
if $has_paths {
$completions | update value {|row|
if $row.value =~ ' ' {
$"'($row.value)'" # Wrap in single quotes
} else {
$row.value
}
}
} else {
$completions
}
}
'';
plugins = [ pkgs.nushellPlugins.skim ];
};
}