mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-13 12:13:36 +01:00
refactor(shells): use native Home Manager Nushell and Nushell login on non-desktop hosts (#513)
* refactor(shells): use native Home Manager Nushell environment Replace the Bash login-shell wrapper and hand-maintained Nushell PATH with programs.nushell.loadSessionVariables and home.sessionPath. Launch Nushell directly from Kitty, Ghostty, and Zed, with the macOS config-home override and Ghostty's vendor autoload directory. Upstream feature: https://github.com/nix-community/home-manager/pull/9666 Assisted-by: DeepSeek Harness (deepseek-flash) * feat(hosts): use Nushell as login shell on Ruby and Kana Set the per-user shell explicitly and add Nushell to the system shell list. The system default shell and root remain unchanged. Assisted-by: DeepSeek Harness (deepseek-flash) * fix(ssh): preserve tuios session marker across SSH Forward TUIOS_SESSION and accept it on NixOS sshd, so an SSH session opened from inside tuios does not auto-attach a nested remote tuios. Assisted-by: DeepSeek Harness (deepseek-flash) * feat(nixos): use Nushell login shell on non-desktop hosts Enable the Nushell login shell through a shared module imported by the server and agent profiles. Desktop profiles continue to use Bash. Assisted-by: DeepSeek Harness (deepseek-flash) * fix(tuios): skip auto-attach in SSH sessions Remote interactive shells now stay plain Nushell instead of starting a nested TUIOS when the SSH client is already inside a local TUIOS session. Local TUIOS auto-start is unchanged. Assisted-by: DeepSeek Harness (deepseek-flash)
This commit is contained in:
1 parent
e3bc8cbe4c
commit
d8b298019a
10 files changed
+40
-49
No files matched your search
@@ -189,15 +189,6 @@ const NU_PLUGIN_DIRS = [
|
||||
|
||||
# As with NU_LIB_DIRS, an $env.NU_PLUGIN_DIRS is searched after the constant version
|
||||
|
||||
# The `path add` function from the Standard Library also provides
|
||||
# a convenience method for prepending to the path:
|
||||
use std/util "path add"
|
||||
path add "~/.local/bin"
|
||||
# Tools installed outside Nix (go install / cargo install / npm -g).
|
||||
path add "~/go/bin"
|
||||
path add "~/.cargo/bin"
|
||||
path add "~/.npm/bin"
|
||||
|
||||
# You can remove duplicate directories from the path using:
|
||||
$env.PATH = ($env.PATH | uniq)
|
||||
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
{ ... }:
|
||||
{ config, ... }:
|
||||
{
|
||||
# Kept only for the `~/.profile` it generates: that file sources `hm-session-vars.sh`,
|
||||
# and the terminals launch `bash --login -c 'nu ...'`, so it is how `home.sessionVariables`
|
||||
# reach nushell. Bash itself needs no env/alias setup here — nushell owns those, and a bash
|
||||
# spawned from within nushell inherits the environment.
|
||||
# Bash remains the login shell.
|
||||
programs.bash.enable = true;
|
||||
|
||||
programs.nushell = {
|
||||
enable = true;
|
||||
# Adopt the 26.11 default: source Home Manager's session environment from
|
||||
# env.nu instead of relying only on the bash-login wrapper.
|
||||
loadSessionVariables = true;
|
||||
configFile.source = ./config.nu;
|
||||
};
|
||||
|
||||
# Tools installed outside Nix.
|
||||
home.sessionPath = [
|
||||
"${config.home.homeDirectory}/.local/bin"
|
||||
"${config.home.homeDirectory}/go/bin"
|
||||
"${config.home.homeDirectory}/.cargo/bin"
|
||||
"${config.home.homeDirectory}/.npm/bin"
|
||||
];
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
@@ -36,11 +37,7 @@
|
||||
# Start fullscreen on macOS; window managers control this on Linux.
|
||||
fullscreen = pkgs.stdenv.hostPlatform.isDarwin;
|
||||
|
||||
# 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`
|
||||
command = "${pkgs.bash}/bin/bash --login -c 'nu --login --interactive'";
|
||||
command = "${lib.getExe config.programs.nushell.package} --config-home ${config.programs.nushell.configDir}";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
@@ -32,11 +33,7 @@
|
||||
macos_option_as_alt = true; # Option key acts as Alt on macOS
|
||||
enable_audio_bell = false;
|
||||
|
||||
# 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'";
|
||||
shell = "${lib.getExe config.programs.nushell.package} --config-home ${config.programs.nushell.configDir}";
|
||||
};
|
||||
|
||||
# macOS specific settings
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
catppuccin.zed.enable = true;
|
||||
|
||||
@@ -39,11 +43,10 @@
|
||||
|
||||
# Terminal
|
||||
terminal.shell.with_arguments = {
|
||||
program = "bash";
|
||||
program = lib.getExe config.programs.nushell.package;
|
||||
args = [
|
||||
"--login"
|
||||
"-c"
|
||||
"nu --login --interactive"
|
||||
"--config-home"
|
||||
config.programs.nushell.configDir
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ in
|
||||
xdg.configFile."tuios/config.toml".source =
|
||||
config.lib.file.mkOutOfStoreSymlink "${configDir}/config.toml";
|
||||
|
||||
# auto-start tuios in interactive shells, except when already inside tuios.
|
||||
# auto-start tuios in local interactive shells, except when already inside
|
||||
# tuios or connected over SSH.
|
||||
# `work` for the ~/work tree, `personal` for everything else (a host with no
|
||||
# ~/work gets `personal` everywhere).
|
||||
programs.nushell.extraConfig = ''
|
||||
@@ -27,7 +28,7 @@ in
|
||||
$env.TERM = "xterm-kitty"
|
||||
}
|
||||
|
||||
if $nu.is-interactive and (not ("TUIOS_SESSION" in $env)) {
|
||||
if $nu.is-interactive and (not ("TUIOS_SESSION" in $env)) and (not ("SSH_CONNECTION" in $env)) {
|
||||
# Exit 3 means the daemon is stopped; stdout still lists saved sessions.
|
||||
let listing = (^tuios ls --json | complete)
|
||||
if $listing.exit_code not-in [0 3] {
|
||||
|
||||
+8
-16
@@ -1,22 +1,14 @@
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
envExtra = ''
|
||||
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
|
||||
'';
|
||||
in
|
||||
{ config, ... }:
|
||||
{
|
||||
# Homebrew's default install location:
|
||||
# /opt/homebrew for Apple Silicon
|
||||
# /usr/local for macOS Intel
|
||||
# The prefix /opt/homebrew was chosen to allow installations
|
||||
# in /opt/homebrew for Apple Silicon and /usr/local for Rosetta 2 to coexist and use bottles.
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
bashrcExtra = lib.mkAfter envExtra;
|
||||
};
|
||||
# Homebrew install locations for Apple Silicon and Intel.
|
||||
home.sessionPath = [
|
||||
"/opt/homebrew/bin"
|
||||
"/usr/local/bin"
|
||||
];
|
||||
|
||||
programs.bash.enable = true;
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
dotDir = "${config.xdg.configHome}/zsh";
|
||||
inherit envExtra;
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user