nushell: direnv, fish completion fallback, aliases

This commit is contained in:
mehbark 2025-06-26 15:33:39 -04:00
parent 858fa7d815
commit a5829572c3
2 changed files with 51 additions and 2 deletions

View file

@ -169,7 +169,6 @@ in
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICyTxPV3S7ms0AJ0tduI3aJP3o2TJCnkirWKaj5i1+DW"
];
shell = pkgs.nushell;
};
virtualisation.vmVariant = {

View file

@ -1,5 +1,5 @@
{ conf, more-packages ? [], darwin ? false }:
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
let
wm = conf.wm;
in
@ -161,6 +161,55 @@ in
shellInit = import ./fish.conf.nix;
};
programs.nushell = {
enable = true;
plugins = with pkgs.nushellPlugins; [
units
];
settings = {
show_banner = false;
completions.external = {
enable = true;
max_results = 200;
completer = lib.hm.nushell.mkNushellInline ''
{|spans|
fish --command $"complete '--do-complete=($spans | str replace --all "'" "\\'" | str join ' ')'"
| from tsv --flexible --noheaders --no-infer
| rename value description
| update value {
if ($in | path exists) {$'"($in | path expand --no-symlink | str replace --all "\"" "\\\"" )"'} else {$in}
}
}
'';
};
};
shellAliases = {
v = "nvim";
ce = "code .";
yt = "yt-dlp";
icat = "kitty +kitten icat";
c = "cargo";
cr = "cargo run";
cb = "cargo build";
ct = "cargo test";
cbr = "cargo build --release";
crr = "cargo run --release";
g = "git";
gc = "git commit -m";
gst = "git status";
ga = "git add";
gp = "git push";
gl = "git log --oneline --graph --decorate --all";
};
};
programs.zsh.enable = true;
programs.vscode = {
@ -432,6 +481,7 @@ in
programs.direnv.enable = true;
programs.direnv.nix-direnv.enable = true;
programs.direnv.enableNushellIntegration = true;
programs.home-manager.enable = true;