config.nu
1 $env.__NIX_DARWIN_SET_ENVIRONMENT_DONE = 1 2 3 $env.PATH = [ 4 $"($env.HOME)/.nix-profile/bin" 5 $"/etc/profiles/per-user/($env.USER)/bin" 6 $"($env.HOME)/Library/Python/3.9/bin" 7 "/run/current-system/sw/bin" 8 "/nix/var/nix/profiles/default/bin" 9 "/usr/local/bin" 10 "/usr/bin" 11 "/usr/sbin" 12 "/bin" 13 "/sbin" 14 ] 15 $env.NIX_PATH = [ 16 $"darwin-config=($env.HOME)/.nixpkgs/darwin-configuration.nix" 17 "/nix/var/nix/profiles/per-user/root/channels" 18 ] 19 $env.NIX_SSL_CERT_FILE = "/etc/ssl/certs/ca-certificates.crt" 20 $env.TERMINFO_DIRS = [ 21 $"($env.HOME)/.nix-profile/share/terminfo" 22 $"/etc/profiles/per-user/($env.USER)/share/terminfo" 23 "/run/current-system/sw/share/terminfo" 24 "/nix/var/nix/profiles/default/share/terminfo" 25 "/usr/share/terminfo" 26 ] 27 $env.XDG_CONFIG_DIRS = [ 28 $"($env.HOME)/.nix-profile/etc/xdg" 29 $"/etc/profiles/per-user/($env.USER)/etc/xdg" 30 "/run/current-system/sw/etc/xdg" 31 "/nix/var/nix/profiles/default/etc/xdg" 32 ] 33 $env.XDG_DATA_DIRS = [ 34 $"($env.HOME)/.nix-profile/share" 35 $"/etc/profiles/per-user/($env.USER)/share" 36 "/run/current-system/sw/share" 37 "/nix/var/nix/profiles/default/share" 38 ] 39 $env.NIX_USER_PROFILE_DIR = $"/nix/var/nix/profiles/per-user/($env.USER)" 40 $env.NIX_PROFILES = [ 41 "/nix/var/nix/profiles/default" 42 "/run/current-system/sw" 43 $"/etc/profiles/per-user/($env.USER)" 44 $"($env.HOME)/.nix-profile" 45 ] 46 47 $env.LS_COLORS = (vivid generate rose-pine-dawn) 48 49 if ($"($env.HOME)/.nix-defexpr/channels" | path exists) { 50 $env.NIX_PATH = ($env.PATH | split row (char esep) | append $"($env.HOME)/.nix-defexpr/channels") 51 } 52 53 if (false in (ls -l `/nix/var/nix`| where type == dir | where name == "/nix/var/nix/db" | get mode | str contains "w")) { 54 $env.NIX_REMOTE = "daemon" 55 } 56 57 const cfg = ($nu.config-path | path dirname) 58 59 source ($cfg | path join "bash-env.nu") 60 61 bash-env ~/.profile | load-env 62 brew shellenv | bash-env | load-env 63 64 source ($cfg | path join "alias.nu") 65 source ($cfg | path join "ai.nu") 66 source ($cfg | path join "zoxide.nu") 67 68 use ($cfg | path join "rose-pine-dawn.nu") 69 70 let carapace_completer = {|spans| 71 carapace $spans.0 nushell ...$spans | from json 72 } 73 74 const history_path = ($nu.data-dir | path join "history.txt") 75 76 $env.config = { 77 edit_mode: 'vi', 78 color_config: (rose-pine-dawn), 79 shell_integration: { 80 osc2: true 81 osc7: true 82 osc8: true 83 osc9_9: false 84 osc133: false 85 osc633: false 86 }, 87 history: { 88 file_format: sqlite 89 max_size: 1_000_000 90 sync_on_enter: true 91 isolation: true 92 }, 93 buffer_editor: "nvim", 94 show_banner: false, 95 table: { 96 mode: "compact" 97 }, 98 completions: { 99 case_sensitive: false, 100 quick: true, 101 partial: true, 102 algorithm: "fuzzy", 103 external: { 104 enable: true 105 max_results: 100 106 completer: $carapace_completer 107 } 108 }, 109 hooks: { 110 pre_prompt: [{ || 111 if (which direnv | is-empty) { 112 return 113 } 114 115 direnv export json | from json | default {} | load-env 116 if 'ENV_CONVERSIONS' in $env and 'PATH' in $env.ENV_CONVERSIONS { 117 $env.PATH = do $env.ENV_CONVERSIONS.PATH.from_string $env.PATH 118 } 119 }] 120 } 121 } 122 123 const NU_PLUGIN_DIRS = [ 124 ($nu.current-exe | path dirname) 125 ...$NU_PLUGIN_DIRS 126 ] 127 128 $env.config.hooks.pre_prompt = ($env.config.hooks.pre_prompt | append { 129 { 130 condition: {|| not ($nu.data-dir | path join "vendor/autoload/starship.nu" | path exists) } 131 code: {|| 132 mkdir ($nu.data-dir | path join "vendor/autoload") 133 starship init nu | save -f ($nu.data-dir | path join "vendor/autoload/starship.nu") 134 } 135 } 136 }) 137 138 source ($nu.data-dir | path join "vendor/autoload/starship.nu")