From 4f7d109a373d8ec2f57fda46bb35b3af7072b5b9 Mon Sep 17 00:00:00 2001 From: Matt Nish-Lapidus Date: Wed, 2 Jul 2025 11:31:05 -0400 Subject: [PATCH] nushell and prompt play --- flake.lock | 42 ++++++++--------- hosts/eddie/configuration.nix | 1 + modules/home/shell-conf/nushell/config.nu | 45 ++++++++++++++++++- modules/home/shell-conf/nushell/nushell.nix | 4 ++ .../home/shell-conf/starship/starship.toml | 17 ++++--- 5 files changed, 82 insertions(+), 27 deletions(-) diff --git a/flake.lock b/flake.lock index 8400dbf..daa5203 100644 --- a/flake.lock +++ b/flake.lock @@ -137,11 +137,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1751361224, - "narHash": "sha256-x7+c5lFhoZapaQGvkyExaF8mt5u29+4l0DJwQWUspH4=", + "lastModified": 1751447566, + "narHash": "sha256-PD6SIXio6A44d0BjfUYPUyC9SyHnGcQP5N/ceoGJsno=", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "6ab8bb6826895f1ac82366eddeed184a69729e5a", + "rev": "6b5c9e8d4cfe157a398aedf877ad6fbb71c6bca6", "type": "github" }, "original": { @@ -541,11 +541,11 @@ ] }, "locked": { - "lastModified": 1751384836, - "narHash": "sha256-7xRbl/VLXxE5DzJmk1wdKWJmPx8rAfNC/a6mXtqp5cc=", + "lastModified": 1751463936, + "narHash": "sha256-kS8p1QgyFO/95BHSsZMpBs8oRh1bklAd/zzpWhF6ODk=", "owner": "nix-community", "repo": "home-manager", - "rev": "479f8889675770881033878a1c114fbfc6de7a4d", + "rev": "3d243d4a16cafe855df585b3030aa99261a27a86", "type": "github" }, "original": { @@ -832,11 +832,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1751379130, - "narHash": "sha256-TObxiGbuX/4FbOnzDRvznfMUjIgS+d71+BetT35EOB8=", + "lastModified": 1751432711, + "narHash": "sha256-136MeWtckSHTN9Z2WRNRdZ8oRP3vyx3L8UxeBYE+J9w=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "8b1f894089789eb39eacf0d6891d1e17cc3a84ab", + "rev": "497ae1357f1ac97f1aea31a4cb74ad0d534ef41f", "type": "github" }, "original": { @@ -908,11 +908,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1751048012, - "narHash": "sha256-MYbotu4UjWpTsq01wglhN5xDRfZYLFtNk7SBY0BcjkU=", + "lastModified": 1751274312, + "narHash": "sha256-/bVBlRpECLVzjV19t5KMdMFWSwKLtb5RyXdjz3LJT+g=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a684c58d46ebbede49f280b653b9e56100aa3877", + "rev": "50ab793786d9de88ee30ec4e4c24fb4236fc2674", "type": "github" }, "original": { @@ -1036,11 +1036,11 @@ }, "nixpkgs_7": { "locked": { - "lastModified": 1748460289, - "narHash": "sha256-7doLyJBzCllvqX4gszYtmZUToxKvMUrg45EUWaUYmBg=", + "lastModified": 1751011381, + "narHash": "sha256-krGXKxvkBhnrSC/kGBmg5MyupUUT5R6IBCLEzx9jhMM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "96ec055edbe5ee227f28cdbc3f1ddf1df5965102", + "rev": "30e2e2857ba47844aa71991daa6ed1fc678bcbb7", "type": "github" }, "original": { @@ -1453,11 +1453,11 @@ "nixpkgs": "nixpkgs_7" }, "locked": { - "lastModified": 1751383914, - "narHash": "sha256-v+lQnPqTUVuo/aL8pZ5kJWo9VwWUjlGTenq4FXRzYYY=", + "lastModified": 1751446291, + "narHash": "sha256-CbvStVJ0bzrIHh2CkaM2epMB1AoTJMAw+Mx/ORJTOdY=", "owner": "Alexays", "repo": "Waybar", - "rev": "88766de1ee496c57af3823557c43d435ced3daa1", + "rev": "f409f53131b3061a4c8f08f3a39abe1e3417ff4b", "type": "github" }, "original": { @@ -1599,11 +1599,11 @@ ] }, "locked": { - "lastModified": 1751383329, - "narHash": "sha256-52dUY8jEkuXEIZINYb+AVsrmw6FxMhBAG3K9J/2qiSo=", + "lastModified": 1751440815, + "narHash": "sha256-cBEcG90ahVVPMKEHiyn13KT7cxpcEwSOqrLhgz5/M9k=", "owner": "0xc000022070", "repo": "zen-browser-flake", - "rev": "f29a4fece3b76c3e4579d67e2cf0cb8037f6a351", + "rev": "a37c444f51b3e7df8ea3333c57a4154c6b09dc39", "type": "github" }, "original": { diff --git a/hosts/eddie/configuration.nix b/hosts/eddie/configuration.nix index 0d06763..5bd099f 100644 --- a/hosts/eddie/configuration.nix +++ b/hosts/eddie/configuration.nix @@ -212,6 +212,7 @@ greetd-password.enableGnomeKeyring = true; niri.enableGnomeKeyring = true; swaylock.enableGnomeKeyring = true; + swayidle.enableGnomeKeyring = true; }; }; }; diff --git a/modules/home/shell-conf/nushell/config.nu b/modules/home/shell-conf/nushell/config.nu index 3abe6a9..d8e05ce 100644 --- a/modules/home/shell-conf/nushell/config.nu +++ b/modules/home/shell-conf/nushell/config.nu @@ -1,6 +1,12 @@ $env.config.completions.external.completer = $fish_completer $env.LS_COLORS = (vivid generate one-dark) +$env.TRANSIENT_PROMPT_COMMAND = ^starship module character +$env.TRANSIENT_PROMPT_INDICATOR = "" +$env.TRANSIENT_PROMPT_INDICATOR_VI_INSERT = "" +$env.TRANSIENT_PROMPT_INDICATOR_VI_NORMAL = "" +$env.TRANSIENT_PROMPT_MULTILINE_INDICATOR = "" +$env.TRANSIENT_PROMPT_COMMAND_RIGHT = ^starship module time def --env doomup [...args] { doom sync ...$args @@ -9,7 +15,7 @@ def --env doomup [...args] { } def --env lla [...args] { - ls -alm ...$args | select name size type mode + ls -alm ...$args | select name type size modified mode user group } # def --env pullall [] { @@ -19,3 +25,40 @@ def --env lla [...args] { def pdf-compress [...args] { gs -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -dNOPAUSE -dBATCH -sOutputFile=output.pdf $args } + +def nh-switch-gc [...args] { + nh os switch; nh clean all --keep 3 --nogcroots; nix store optimise; +} + +def "nu-complete zoxide path" [context: string] { + let parts = $context | str trim --left | split row " " | skip 1 | each { str downcase } + let completions = ( + ^zoxide query --list --exclude $env.PWD -- ...$parts + | lines + | each { |dir| + if ($parts | length) <= 1 { + $dir + } else { + let dir_lower = $dir | str downcase + let rem_start = $parts | drop 1 | reduce --fold 0 { |part, rem_start| + ($dir_lower | str index-of --range $rem_start.. $part) + ($part | str length) + } + { + value: ($dir | str substring $rem_start..), + description: $dir + } + } + }) + { + options: { + sort: false, + completion_algorithm: substring, + case_sensitive: false, + }, + completions: $completions, + } +} + +def --env --wrapped z [...rest: string@"nu-complete zoxide path"] { + __zoxide_z ...$rest +} diff --git a/modules/home/shell-conf/nushell/nushell.nix b/modules/home/shell-conf/nushell/nushell.nix index 54671c5..22403b5 100644 --- a/modules/home/shell-conf/nushell/nushell.nix +++ b/modules/home/shell-conf/nushell/nushell.nix @@ -1,6 +1,10 @@ { config, lib, pkgs, ... }: { + home.packages = with pkgs; [ + nu_scripts + ]; + programs.nushell = { enable = true; shellAliases = { diff --git a/modules/home/shell-conf/starship/starship.toml b/modules/home/shell-conf/starship/starship.toml index 9e6b44e..f77175e 100644 --- a/modules/home/shell-conf/starship/starship.toml +++ b/modules/home/shell-conf/starship/starship.toml @@ -1,14 +1,21 @@ "$schema" = 'https://starship.rs/config-schema.json' -format = "$env_var$all$line_break$character" +format = "$env_var$shell$all$line_break$character" +right_format = "" + +[shell] +fish_indicator = '󰈺 ' +nu_indicator = 'nu' +style = "#aaaaaa" +format = '[$indicator ]($style) ' +disabled = false [env_var.yazi_level] description = "Indicate the shell was launched by `yazi`" variable = "YAZI_LEVEL" -# 🦆: U+1f986 Duck -# Alternatively: " ": U+E795 -symbol = "🦆" -format = '[ $symbol ]($style)' +symbol = "󰇥" +style = "yellow" +format = '[$symbol  ]($style)' [directory] truncation_length = 0