From 4f0a92e43bceb91879029ac6f5bb389658708b56 Mon Sep 17 00:00:00 2001 From: m3tm3re
Date: Sat, 28 Mar 2026 10:29:05 +0100 Subject: [PATCH] fix: nushell tv warning m3-atlas --- home/features/cli/nushell.nix | 146 ++++++---------------------------- 1 file changed, 26 insertions(+), 120 deletions(-) diff --git a/home/features/cli/nushell.nix b/home/features/cli/nushell.nix index 7daea55..9c0f350 100644 --- a/home/features/cli/nushell.nix +++ b/home/features/cli/nushell.nix @@ -18,56 +18,34 @@ in { $env.WEBKIT_DISABLE_COMPOSITING_MODE = "1" $env.TERMINAL = "ghostty" $env.EDITOR = "nvim" - $env.VISUAL = "zed" + $env.VISUAL = "zeditor" $env.FZF_DEFAULT_COMMAND = "fd --type f --exclude .git --follow --hidden" - $env.FZF_DEFAULT_OPTS = "--preview='bat --color=always --style=numbers --line-range=:500 {}' --bind 'ctrl-/:toggle-preview' --header 'Press CTRL-Y to copy to clipboard' --bind 'ctrl-y:execute-silent(echo {} | wl-copy)' --color bg:#${config.colorScheme.palette.base00},bg+:#${config.colorScheme.palette.base02},fg:#${config.colorScheme.palette.base05},fg+:#${config.colorScheme.palette.base05},header:#${config.colorScheme.palette.base03},hl:#${config.colorScheme.palette.base0E},hl+:#${config.colorScheme.palette.base0E},info:#${config.colorScheme.palette.base09},marker:#${config.colorScheme.palette.base08},pointer:#${config.colorScheme.palette.base08},prompt:#${config.colorScheme.palette.base0B},spinner:#${config.colorScheme.palette.base09}" + $env.FZF_DEFAULT_OPTS = "--preview='bat --color=always -n {}' --bind 'ctrl-/:toggle-preview' --header 'Press CTRL-Y to copy command into clipboard' --bind 'ctrl-/:toggle-preview' --bind 'ctrl-y:execute-silent(echo -n {2..} | wl-copy)+abort' --color bg:#282a36,bg+:#44475a,fg:#f8f8f2,fg+:#f8f8f2,header:#6272a4,hl:#bd93f9,hl+:#bd93f9,info:#ffb86c,marker:#ff79c6,pointer:#ff79c6,prompt:#50fa7b,spinner:#ffb86c" $env.XDG_DATA_HOME = $"($env.HOME)/.local/share" $env.FZF_DEFAULT_COMMAND = "fd --type f --exclude .git --follow --hidden" $env.SSH_AUTH_SOCK = "/run/user/1000/gnupg/S.gpg-agent.ssh" - $env.FLAKE = $"($env.HOME)/p/nixos/nixos-config" - $env.PATH = ($env.PATH | split row (char esep) | append "/home/m3tam3re/.cache/.bun/bin" | uniq) - source /run/agenix/${config.home.username}-secrets + $env.PATH = ($env.PATH | split row (char esep) | append "/home/sascha.koenig/.cache/.bun/bin" | uniq) + $env.FLAKE = $"($env.HOME)/p/NIX/nixos-config" + + # Load kestractl-env from agenix + if ("/run/agenix/kestractl-env" | path exists) { + open /run/agenix/kestractl-env + | lines + | where {($in | str trim | str length) > 0} + | parse "{key}={value}" + | update value {str trim -c '"'} + | transpose -r -d + | load-env + } ''; + + # if (tty) == "/dev/tty1" { + # exec uwsm start -S -F /run/current-system/sw/bin/Hyprland + # } + # if (tty) == "/dev/tty2" { + # exec gamescope -O HDMI-A-1 -W 1920 -H 1080 --adaptive-sync --hdr-enabled --rt --steam -- steam -pipewire-dmabuf -tenfoot + # } configFile.text = '' - # FZF integration functions for nushell - def fzf-file [] { - fd --type f --exclude .git --follow --hidden | fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}' --bind 'ctrl-y:execute-silent(echo {} | wl-copy)' - } - - def fzf-dir [] { - fd --type d --exclude .git --follow --hidden | fzf --preview 'ls -la {}' - } - - def fzf-history [] { - history | get command | reverse | fzf --bind 'ctrl-y:execute-silent(echo {} | wl-copy)' - } - - # Key bindings for FZF - $env.config = { - keybindings: [ - { - name: fzf_file - modifier: control - keycode: char_t - mode: [emacs, vi_normal, vi_insert] - event: { - send: executehostcommand - cmd: "commandline edit --insert (fzf-file)" - } - } - { - name: fzf_history - modifier: control - keycode: char_r - mode: [emacs, vi_normal, vi_insert] - event: { - send: executehostcommand - cmd: "commandline edit --replace (fzf-history)" - } - } - ] - } - # Aliases alias .. = cd .. alias ... = cd ... @@ -76,6 +54,7 @@ in { alias lt = eza --tree --level=2 --long --icons --git alias grep = rg alias just = just --unstable + alias node = bun alias npx = bunx @@ -101,83 +80,10 @@ in { alias vi = nvim alias vim = nvim - def history_fuzzy [] { - let selected = ( - history - | reverse - | get command - | uniq - | to text - | ^fzf - ) - if ($selected | is-not-empty) { - commandline edit ($selected) - } else { - null - } + if (which tv | is-not-empty) { + mkdir ($nu.data-dir | path join "vendor/autoload") + tv init nu | save -f ($nu.data-dir | path join "vendor/autoload/tv.nu") } - def --env dir_fuzzy [] { - let selected = ( - fd --type directory - | ^fzf - ) - cd $selected - } - def find_fuzzy [] { - # Find non-hidden text files with matches for any content and select one via fuzzy search - let selected = ( - ^fd --type file --no-hidden -X rg -l --files-with-matches . - | lines - | to text - | ^fzf - ) - if ($selected | is-not-empty) { - ^$env.EDITOR $selected - } - } - - $env.config = { - keybindings: [ - { - name: history_fuzzy - modifier: control - keycode: char_r - mode: [emacs, vi_insert, vi_normal] - event: [ - { - send: executehostcommand - cmd: "history_fuzzy" - } - ] - } - { - name: dir_fuzzy - modifier: alt - keycode: char_c - mode: [emacs, vi_insert, vi_normal] - event: [ - { - send: executehostcommand - cmd: "dir_fuzzy" - } - ] - } - { - name: history_fuzzy - modifier: control - keycode: char_t - mode: [emacs, vi_insert, vi_normal] - event: [ - { - send: executehostcommand - cmd: "find_fuzzy" - } - ] - } - ] - } - mkdir ($nu.data-dir | path join "vendor/autoload") - tv init nu | save -f ($nu.data-dir | path join "vendor/autoload/tv.nu") ''; }; };