diff --git a/home/base/core/shells/config.nu b/home/base/core/shells/config.nu index f79d886a..880ee79d 100644 --- a/home/base/core/shells/config.nu +++ b/home/base/core/shells/config.nu @@ -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) diff --git a/home/base/core/shells/default.nix b/home/base/core/shells/default.nix index d23ac12d..9f8557ca 100644 --- a/home/base/core/shells/default.nix +++ b/home/base/core/shells/default.nix @@ -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" + ]; } diff --git a/home/base/gui/terminal/ghostty.nix b/home/base/gui/terminal/ghostty.nix index 7dc0deba..ff1418c8 100644 --- a/home/base/gui/terminal/ghostty.nix +++ b/home/base/gui/terminal/ghostty.nix @@ -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}"; }; }; } diff --git a/home/base/gui/terminal/kitty.nix b/home/base/gui/terminal/kitty.nix index 5e468ade..daf4daf8 100644 --- a/home/base/gui/terminal/kitty.nix +++ b/home/base/gui/terminal/kitty.nix @@ -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 diff --git a/home/base/gui/zed-editor.nix b/home/base/gui/zed-editor.nix index 6e6d4952..443e2942 100644 --- a/home/base/gui/zed-editor.nix +++ b/home/base/gui/zed-editor.nix @@ -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 ]; }; diff --git a/home/base/tui/tuios/default.nix b/home/base/tui/tuios/default.nix index b263d440..0f1ab016 100644 --- a/home/base/tui/tuios/default.nix +++ b/home/base/tui/tuios/default.nix @@ -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] { diff --git a/home/darwin/shell.nix b/home/darwin/shell.nix index 9aac8ec3..8285a3c5 100644 --- a/home/darwin/shell.nix +++ b/home/darwin/shell.nix @@ -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; }; } diff --git a/modules/nixos/nushell-login.nix b/modules/nixos/nushell-login.nix new file mode 100644 index 00000000..e309600d --- /dev/null +++ b/modules/nixos/nushell-login.nix @@ -0,0 +1,5 @@ +{ myvars, pkgs, ... }: +{ + users.users.${myvars.username}.shell = pkgs.nushell; + environment.shells = [ pkgs.nushell ]; +} diff --git a/modules/nixos/server/server-aarch64.nix b/modules/nixos/server/server-aarch64.nix index 7fe04241..dbc768a9 100644 --- a/modules/nixos/server/server-aarch64.nix +++ b/modules/nixos/server/server-aarch64.nix @@ -11,6 +11,7 @@ (mylib.relativeToRoot "hardening/kernel-hardening.nix") ../base/monitoring.nix ../base/nix.nix + ../nushell-login.nix ../base/packages.nix ../base/ssh.nix ../base/user-group.nix diff --git a/modules/nixos/server/server.nix b/modules/nixos/server/server.nix index 9fb88868..62bb5f15 100644 --- a/modules/nixos/server/server.nix +++ b/modules/nixos/server/server.nix @@ -2,6 +2,7 @@ { imports = [ ../base + ../nushell-login.nix ../../base ];