From d45c5c783954b7cfe34baa89af5cfac344564658 Mon Sep 17 00:00:00 2001 From: jolheiser Date: Fri, 11 Aug 2023 19:48:14 -0500 Subject: [PATCH] chore: update nushell env and completions Signed-off-by: jolheiser --- apps/nushell.nix | 6 +++--- apps/nushell/config.nu | 2 +- apps/nushell/env.nu | 20 ++++++++++---------- apps/nushell/jolheiser.nu | 4 ++-- apps/nushell/ohmyposh.nu | 16 ++++++++-------- apps/nushell/zoxide.nu | 12 ++++++------ machines/common/default.nix | 2 +- 7 files changed, 31 insertions(+), 31 deletions(-) diff --git a/apps/nushell.nix b/apps/nushell.nix index e03f202..a149e8c 100644 --- a/apps/nushell.nix +++ b/apps/nushell.nix @@ -20,12 +20,12 @@ use ${pkgs.nu_scripts}/share/nu_scripts/custom-completions/btm/btm-completions.nu * use ${pkgs.nu_scripts}/share/nu_scripts/custom-completions/git/git-completions.nu * use ${pkgs.nu_scripts}/share/nu_scripts/custom-completions/glow/glow-completions.nu * - use ${pkgs.nu_scripts}/share/nu_scripts/custom-completions/just/just.nu * + use ${pkgs.nu_scripts}/share/nu_scripts/custom-completions/just/just-completions.nu * use ${pkgs.nu_scripts}/share/nu_scripts/custom-completions/nix/nix-completions.nu * ''; extraEnv = '' - let-env GOPATH = "${config.xdg.dataHome}/go" - let-env PATH = ($env.PATH | split row (char esep) | prepend '${config.xdg.dataHome}/go/bin') + $env.GOPATH = "${config.xdg.dataHome}/go" + $env.PATH = ($env.PATH | split row (char esep) | prepend '${config.xdg.dataHome}/go/bin') ''; }; xdg.configFile = { diff --git a/apps/nushell/config.nu b/apps/nushell/config.nu index f4cf541..1fa7962 100644 --- a/apps/nushell/config.nu +++ b/apps/nushell/config.nu @@ -297,7 +297,7 @@ let light_theme = { # The default config record. This is where much of your global configuration is setup. -let-env config = { +$env.config = { ls: { use_ls_colors: true # use the LS_COLORS environment variable to colorize output clickable_links: true # enable or disable clickable links. Your terminal has to support links. diff --git a/apps/nushell/env.nu b/apps/nushell/env.nu index 0269f3f..0cafdd2 100644 --- a/apps/nushell/env.nu +++ b/apps/nushell/env.nu @@ -19,21 +19,21 @@ def create_right_prompt [] { } # Use nushell functions to define your right and left prompt -let-env PROMPT_COMMAND = { create_left_prompt } -let-env PROMPT_COMMAND_RIGHT = { create_right_prompt } +$env.PROMPT_COMMAND = { create_left_prompt } +$env.PROMPT_COMMAND_RIGHT = { create_right_prompt } # The prompt indicators are environmental variables that represent # the state of the prompt -let-env PROMPT_INDICATOR = { "〉" } -let-env PROMPT_INDICATOR_VI_INSERT = { ": " } -let-env PROMPT_INDICATOR_VI_NORMAL = { "〉" } -let-env PROMPT_MULTILINE_INDICATOR = { "::: " } +$env.PROMPT_INDICATOR = { "〉" } +$env.PROMPT_INDICATOR_VI_INSERT = { ": " } +$env.PROMPT_INDICATOR_VI_NORMAL = { "〉" } +$env.PROMPT_MULTILINE_INDICATOR = { "::: " } # Specifies how environment variables are: # - converted from a string to a value on Nushell startup (from_string) # - converted from a value back to a string when running external commands (to_string) # Note: The conversions happen *after* config.nu is loaded -let-env ENV_CONVERSIONS = { +$env.ENV_CONVERSIONS = { "PATH": { from_string: { |s| $s | split row (char esep) | path expand -n } to_string: { |v| $v | path expand -n | str join (char esep) } @@ -47,16 +47,16 @@ let-env ENV_CONVERSIONS = { # Directories to search for scripts when calling source or use # # By default, /scripts is added -let-env NU_LIB_DIRS = [ +$env.NU_LIB_DIRS = [ ($nu.config-path | path dirname | path join 'scripts') ] # Directories to search for plugin binaries when calling register # # By default, /plugins is added -let-env NU_PLUGIN_DIRS = [ +$env.NU_PLUGIN_DIRS = [ ($nu.config-path | path dirname | path join 'plugins') ] # To add entries to PATH (on Windows you might use Path), you can use the following pattern: -# let-env PATH = ($env.PATH | split row (char esep) | prepend '/some/path') +# $env.PATH = ($env.PATH | split row (char esep) | prepend '/some/path') diff --git a/apps/nushell/jolheiser.nu b/apps/nushell/jolheiser.nu index 4f90350..6fbd8b3 100644 --- a/apps/nushell/jolheiser.nu +++ b/apps/nushell/jolheiser.nu @@ -26,8 +26,8 @@ def nixdev [ } ## Other ## -let-env EDITOR = hx -let-env config = ($env.config | upsert "shell_integration" ("WEZTERM_PANE" not-in $env and "SSH_CLIENT" not-in $env)) +$env.EDITOR = hx +$env.config = ($env.config | upsert "shell_integration" ("WEZTERM_PANE" not-in $env and "SSH_CLIENT" not-in $env)) source ~/.config/nushell/zoxide.nu source ~/.config/nushell/ohmyposh.nu diff --git a/apps/nushell/ohmyposh.nu b/apps/nushell/ohmyposh.nu index 39dfcb0..f702bff 100644 --- a/apps/nushell/ohmyposh.nu +++ b/apps/nushell/ohmyposh.nu @@ -1,18 +1,18 @@ export-env { - let-env POWERLINE_COMMAND = 'oh-my-posh' - let-env POSH_THEME = "~/.config/oh-my-posh/config.json" - let-env PROMPT_INDICATOR = "" - let-env POSH_PID = (random uuid) + $env.POWERLINE_COMMAND = 'oh-my-posh' + $env.POSH_THEME = "~/.config/oh-my-posh/config.json" + $env.PROMPT_INDICATOR = "" + $env.POSH_PID = (random uuid) # By default displays the right prompt on the first line # making it annoying when you have a multiline prompt # making the behavior different compared to other shells - let-env PROMPT_COMMAND_RIGHT = {''} - let-env NU_VERSION = (version | get version) + $env.PROMPT_COMMAND_RIGHT = {''} + $env.NU_VERSION = (version | get version) # PROMPTS - let-env PROMPT_MULTILINE_INDICATOR = (^oh-my-posh print secondary $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.NU_VERSION)") + $env.PROMPT_MULTILINE_INDICATOR = (^oh-my-posh print secondary $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.NU_VERSION)") - let-env PROMPT_COMMAND = { + $env.PROMPT_COMMAND = { # We have to do this because the initial value of `$env.CMD_DURATION_MS` is always `0823`, # which is an official setting. # See https://github.com/nushell/nushell/discussions/6402#discussioncomment-3466687. diff --git a/apps/nushell/zoxide.nu b/apps/nushell/zoxide.nu index a0c4e1b..ea59b14 100644 --- a/apps/nushell/zoxide.nu +++ b/apps/nushell/zoxide.nu @@ -7,12 +7,12 @@ # Initialize hook to add new entries to the database. if (not ($env | default false __zoxide_hooked | get __zoxide_hooked)) { - let-env __zoxide_hooked = true - let-env config = ($env | default {} config).config - let-env config = ($env.config | default {} hooks) - let-env config = ($env.config | update hooks ($env.config.hooks | default {} env_change)) - let-env config = ($env.config | update hooks.env_change ($env.config.hooks.env_change | default [] PWD)) - let-env config = ($env.config | update hooks.env_change.PWD ($env.config.hooks.env_change.PWD | append {|_, dir| + $env.__zoxide_hooked = true + $env.config = ($env | default {} config).config + $env.config = ($env.config | default {} hooks) + $env.config = ($env.config | update hooks ($env.config.hooks | default {} env_change)) + $env.config = ($env.config | update hooks.env_change ($env.config.hooks.env_change | default [] PWD)) + $env.config = ($env.config | update hooks.env_change.PWD ($env.config.hooks.env_change.PWD | append {|_, dir| zoxide add -- $dir })) } diff --git a/machines/common/default.nix b/machines/common/default.nix index 3fb310e..7aadb45 100644 --- a/machines/common/default.nix +++ b/machines/common/default.nix @@ -64,5 +64,5 @@ systemPackages = with pkgs; [podman podman-compose podman-tui]; }; - fonts.fonts = with pkgs; [(nerdfonts.override {fonts = ["JetBrainsMono"];})]; + fonts.packages = with pkgs; [(nerdfonts.override {fonts = ["JetBrainsMono"];})]; }