From 9f59301a0efe205b7095639f5982e7585f45925d Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Thu, 7 Dec 2023 12:23:16 +0800 Subject: [PATCH] fix: environment variables missed in nushell fix: https://github.com/ryan4yin/nix-config/issues/26 --- home/base/desktop/terminal/alacritty.nix | 12 ++++++++-- home/base/desktop/terminal/kitty.nix | 30 ++++++++++-------------- home/base/desktop/terminal/wezterm.nix | 18 ++++++-------- home/base/server/nushell/default.nix | 10 -------- home/darwin/default.nix | 1 - home/darwin/nushell.nix | 18 -------------- 6 files changed, 30 insertions(+), 59 deletions(-) delete mode 100644 home/darwin/nushell.nix diff --git a/home/base/desktop/terminal/alacritty.nix b/home/base/desktop/terminal/alacritty.nix index 9335a9fe..3a8ac762 100644 --- a/home/base/desktop/terminal/alacritty.nix +++ b/home/base/desktop/terminal/alacritty.nix @@ -83,14 +83,22 @@ # If the bold italic family is not specified, it will fall back to the # value specified for the normal font. family: JetBrainsMono Nerd Font + shell: + # To resolve issues: + # 1. https://github.com/ryan4yin/nix-config/issues/26 + # 2. https://github.com/ryan4yin/nix-config/issues/8 + # Spawn a nushell in login mode via `bash` + program: ${pkgs.bash}/bin/bash + args: + - --login + - -c + - 'nu --login --interactive' '' + ( if pkgs.stdenv.isDarwin then '' # Point size size: 14 - shell: # force nushell as default shell on macOS - program: /run/current-system/sw/bin/nu '' else '' # holder identation diff --git a/home/base/desktop/terminal/kitty.nix b/home/base/desktop/terminal/kitty.nix index 03e4cd5b..92c50283 100644 --- a/home/base/desktop/terminal/kitty.nix +++ b/home/base/desktop/terminal/kitty.nix @@ -16,7 +16,7 @@ # 6. And Other common shortcuts such as Copy, Paste, Cursor Move, etc. # 7. Search in the current window(show_scrollback): `ctrl + shift + h` # This will open a pager, it's defined by `scrollback_pager`, default is `less` -# +# # # Useful Hot Keys for Linux: # 1. New Tab: `ctrl + shift + t` @@ -47,22 +47,18 @@ "ctrl+shift+m" = "toggle_maximized"; }; - settings = - { - background_opacity = "0.93"; - macos_option_as_alt = true; # Option key acts as Alt on macOS - scrollback_lines = 10000; - enable_audio_bell = false; - tab_bar_edge = "top"; # tab bar on top - } - // ( - if pkgs.stdenv.isDarwin - then { - # macOS specific settings, force kitty to use nushell as default shell - shell = "/run/current-system/sw/bin/nu"; - } - else {} - ); + settings = { + background_opacity = "0.93"; + macos_option_as_alt = true; # Option key acts as Alt on macOS + scrollback_lines = 10000; + enable_audio_bell = false; + tab_bar_edge = "top"; # tab bar on top + # To resolve issues: + # 1. https://github.com/ryan4yin/nix-config/issues/26 + # 2. https://github.com/ryan4yin/nix-config/issues/8 + # Spawn a nushell in login mode via `bash` + shell = "${pkgs.bash}/bin/bash --login -c 'nu --login --interactive'"; + }; # macOS specific settings darwinLaunchOptions = ["--start-as=maximized"]; diff --git a/home/base/desktop/terminal/wezterm.nix b/home/base/desktop/terminal/wezterm.nix index abd59c06..56b68946 100644 --- a/home/base/desktop/terminal/wezterm.nix +++ b/home/base/desktop/terminal/wezterm.nix @@ -75,18 +75,14 @@ action = wezterm.action.EmitEvent 'toggle-maximize', }, } - config.font_size = ${fontsize} - '' - + ( - if pkgs.stdenv.isDarwin - then '' - -- Spawn a fish shell in login mod - config.default_prog = { '/run/current-system/sw/bin/nu', '-l' } - '' - else "" - ) - + '' + + -- To resolve issues: + -- 1. https://github.com/ryan4yin/nix-config/issues/26 + -- 2. https://github.com/ryan4yin/nix-config/issues/8 + -- Spawn a nushell in login mode via `bash` + config.default_prog = { '${pkgs.bash}/bin/bash', '--login', '-c', 'nu --login --interactive' } + return config ''; } diff --git a/home/base/server/nushell/default.nix b/home/base/server/nushell/default.nix index 34c2b2b9..b56c7e5a 100644 --- a/home/base/server/nushell/default.nix +++ b/home/base/server/nushell/default.nix @@ -3,16 +3,6 @@ enable = true; configFile.source = ./config.nu; - extraConfig = '' - $env.PATH = ([ - "${config.home.homeDirectory}/bin" - "${config.home.homeDirectory}/.local/bin" - "${config.home.homeDirectory}/go/bin" - - ($env.PATH | split row (char esep)) - ] | flatten) - ''; - # home-manager will merge the cotent in `environmentVariables` with the `envFile.source` # but basically, I set all environment variables via the shell-independent way, so I don't need to use those two options # diff --git a/home/darwin/default.nix b/home/darwin/default.nix index 480f6480..7e1a2fbc 100644 --- a/home/darwin/default.nix +++ b/home/darwin/default.nix @@ -5,7 +5,6 @@ ./proxychains ./core.nix - ./nushell.nix ./rime-squirrel.nix ]; diff --git a/home/darwin/nushell.nix b/home/darwin/nushell.nix deleted file mode 100644 index 7c7e925a..00000000 --- a/home/darwin/nushell.nix +++ /dev/null @@ -1,18 +0,0 @@ -{config, ...}: { - # nix-darwin do not set PATH for nushell! so we need to do it manually - # this is a workaround to add nix's PATH to nushell - programs.nushell.extraConfig = '' - $env.PATH = ([ - "${config.home.homeDirectory}/bin" - "${config.home.homeDirectory}/.local/bin" - "${config.home.homeDirectory}/go/bin" - "/usr/local/bin" - "${config.home.homeDirectory}/.nix-profile/bin" - "/etc/profiles/per-user/${config.home.username}/bin" - "/run/current-system/sw/bin" - "/nix/var/nix/profiles/default/bin" - - ($env.PATH | split row (char esep)) - ] | flatten) - ''; -}