Merge pull request #27 from ryan4yin/fix-nushell-neovim

fix: environment variables missed in nushell
This commit is contained in:
Ryan Yin
2023-12-07 20:10:01 +08:00
committed by GitHub
6 changed files with 30 additions and 59 deletions

View File

@@ -83,14 +83,22 @@
# If the bold italic family is not specified, it will fall back to the # If the bold italic family is not specified, it will fall back to the
# value specified for the normal font. # value specified for the normal font.
family: JetBrainsMono Nerd 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 if pkgs.stdenv.isDarwin
then '' then ''
# Point size # Point size
size: 14 size: 14
shell: # force nushell as default shell on macOS
program: /run/current-system/sw/bin/nu
'' ''
else '' else ''
# holder identation # holder identation

View File

@@ -16,7 +16,7 @@
# 6. And Other common shortcuts such as Copy, Paste, Cursor Move, etc. # 6. And Other common shortcuts such as Copy, Paste, Cursor Move, etc.
# 7. Search in the current window(show_scrollback): `ctrl + shift + h` # 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` # This will open a pager, it's defined by `scrollback_pager`, default is `less`
# #
# #
# Useful Hot Keys for Linux: # Useful Hot Keys for Linux:
# 1. New Tab: `ctrl + shift + t` # 1. New Tab: `ctrl + shift + t`
@@ -47,22 +47,18 @@
"ctrl+shift+m" = "toggle_maximized"; "ctrl+shift+m" = "toggle_maximized";
}; };
settings = settings = {
{ background_opacity = "0.93";
background_opacity = "0.93"; macos_option_as_alt = true; # Option key acts as Alt on macOS
macos_option_as_alt = true; # Option key acts as Alt on macOS scrollback_lines = 10000;
scrollback_lines = 10000; enable_audio_bell = false;
enable_audio_bell = false; tab_bar_edge = "top"; # tab bar on top
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
if pkgs.stdenv.isDarwin # Spawn a nushell in login mode via `bash`
then { shell = "${pkgs.bash}/bin/bash --login -c 'nu --login --interactive'";
# macOS specific settings, force kitty to use nushell as default shell };
shell = "/run/current-system/sw/bin/nu";
}
else {}
);
# macOS specific settings # macOS specific settings
darwinLaunchOptions = ["--start-as=maximized"]; darwinLaunchOptions = ["--start-as=maximized"];

View File

@@ -75,18 +75,14 @@
action = wezterm.action.EmitEvent 'toggle-maximize', action = wezterm.action.EmitEvent 'toggle-maximize',
}, },
} }
config.font_size = ${fontsize} config.font_size = ${fontsize}
''
+ ( -- To resolve issues:
if pkgs.stdenv.isDarwin -- 1. https://github.com/ryan4yin/nix-config/issues/26
then '' -- 2. https://github.com/ryan4yin/nix-config/issues/8
-- Spawn a fish shell in login mod -- Spawn a nushell in login mode via `bash`
config.default_prog = { '/run/current-system/sw/bin/nu', '-l' } config.default_prog = { '${pkgs.bash}/bin/bash', '--login', '-c', 'nu --login --interactive' }
''
else ""
)
+ ''
return config return config
''; '';
} }

View File

@@ -3,16 +3,6 @@
enable = true; enable = true;
configFile.source = ./config.nu; 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` # 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 # but basically, I set all environment variables via the shell-independent way, so I don't need to use those two options
# #

View File

@@ -5,7 +5,6 @@
./proxychains ./proxychains
./core.nix ./core.nix
./nushell.nix
./rime-squirrel.nix ./rime-squirrel.nix
]; ];

View File

@@ -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)
'';
}