improvements

This commit is contained in:
Morten Olsen
2025-12-15 21:58:07 +01:00
parent 220f08ad3a
commit 6a51302799
7 changed files with 335 additions and 505 deletions

View File

@@ -8,7 +8,6 @@
# - Zoxide for smart directory navigation
# - Shell aliases from the chezmoi configuration
# - Environment variables
# - NVM for Node.js version management
{
config,
pkgs,
@@ -40,6 +39,13 @@
share = true;
};
plugins = [
{
name = "fast-syntax-highlighting";
src = "${pkgs.zsh-fast-syntax-highlighting}/share/zsh/site-functions";
}
];
# Session variables (migrated from dot_zshrc and 01-env.sh)
sessionVariables = {
# XDG runtime directory
@@ -76,12 +82,26 @@
grep = "rg";
diff = "delta";
less = "bat";
g = "git";
k = "kubectl --all-namespaces";
ssh = "TERM=screen ssh";
# Neovim alias (from 01-nvim.sh)
vim = "nvim";
vi = "nvim";
# Git root navigation (from 01-env.sh)
gr = "if [ \"`git rev-parse --show-cdup`\" != \"\" ]; then cd `git rev-parse --show-cdup`; fi";
# Misc
psf = "ps -aux | grep";
# Docker
docloc = "docker run --rm -it -v `PWD`:/usr/workdir --workdir=/usr/workdir";
# Nix
nsh = "nix-shell";
nse = "nix search nixpkgs";
};
# Additional initialization (initExtra)
@@ -90,21 +110,23 @@
# Source custom env file if it exists
[ -f ~/.env ] && source ~/.env
# NVM initialization
# Load NVM if installed via Homebrew
if [ -s "/opt/homebrew/opt/nvm/nvm.sh" ]; then
source "/opt/homebrew/opt/nvm/nvm.sh"
fi
# Load NVM bash completion
if [ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ]; then
source "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"
fi
# Pinentry configuration for SSH sessions
if [[ -n "$SSH_CONNECTION" ]]; then
export PINENTRY_USER_DATA="USE_CURSES=1"
fi
function cd() {
builtin cd $*
ls
}
function mkd() {
mkdir $1
builtin cd $1
}
function take() { builtin cd $(mktemp -d) }
# Welcome banner (from dot_zshrc)
# Only show if terminal is wide enough
if [ `tput cols` -gt "70" ]; then
@@ -162,8 +184,13 @@
programs.starship = {
enable = true;
enableZshIntegration = true;
# Starship configuration can be customized here
# settings = { };
settings = {
add_newline = false;
character = {
success_symbol = "[λ](bold green)";
error_symbol = "[λ](bold red)";
};
};
};
# ==========================================================================
@@ -223,4 +250,77 @@
enable = true;
enableZshIntegration = true;
};
programs.pet = {
enable = true;
};
programs.mise = {
enable = true;
enableZshIntegration = true;
enableNushellIntegration = true;
settings = {
experimental = true;
verbose = false;
auto_install = true;
};
};
home.activation.setupMise = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
# use the virtual environment created by uv
# ${pkgs.mise}/bin/mise settings set python.uv_venv_auto true
# enable corepack (pnpm, yarn, etc.)
${pkgs.mise}/bin/mise set MISE_NODE_COREPACK=true
# disable warning about */.node-version files
${pkgs.mise}/bin/mise settings add idiomatic_version_file_enable_tools "[]"
# set global tool versions (auto_install will handle installation)
${pkgs.mise}/bin/mise use --global node@lts
${pkgs.mise}/bin/mise use --global bun@latest
${pkgs.mise}/bin/mise use --global deno@latest
${pkgs.mise}/bin/mise use --global uv@latest
'';
programs.nushell = {
enable = true;
# The config.nu can be anywhere you want if you like to edit your Nushell with Nu
# configFile.source = ./.../config.nu;
# for editing directly to config.nu
extraConfig = ''
let carapace_completer = {|spans|
carapace $spans.0 nushell ...$spans | from json
}
$env.config = {
show_banner: false,
completions: {
case_sensitive: false # case-sensitive completions
quick: true # set to false to prevent auto-selecting completions
partial: true # set to false to prevent partial filling of the prompt
algorithm: "fuzzy" # prefix or fuzzy
external: {
# set to false to prevent nushell looking into $env.PATH to find more suggestions
enable: true
# set to lower can improve completion performance at the cost of omitting some options
max_results: 100
completer: $carapace_completer # check 'carapace_completer'
}
}
}
$env.PATH = ($env.PATH |
split row (char esep) |
append /usr/bin/env
)
'';
shellAliases = {
vi = "hx";
vim = "hx";
nano = "hx";
};
};
programs.carapace = {
enable = true;
enableNushellIntegration = true;
};
}