From a5829572c37b5237d19cbb7b8ce593e96ef8e34f Mon Sep 17 00:00:00 2001 From: mehbark Date: Thu, 26 Jun 2025 15:33:39 -0400 Subject: [PATCH] nushell: direnv, fish completion fallback, aliases --- configuration.nix | 1 - home.nix | 52 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/configuration.nix b/configuration.nix index 8e76d18..9c15146 100644 --- a/configuration.nix +++ b/configuration.nix @@ -169,7 +169,6 @@ in openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICyTxPV3S7ms0AJ0tduI3aJP3o2TJCnkirWKaj5i1+DW" ]; - shell = pkgs.nushell; }; virtualisation.vmVariant = { diff --git a/home.nix b/home.nix index 19aefac..1dec5a5 100644 --- a/home.nix +++ b/home.nix @@ -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;