From 2208a70924c2d6f673f70d835b05e313f0339137 Mon Sep 17 00:00:00 2001 From: yottanami Date: Wed, 29 Jul 2026 13:58:50 +0200 Subject: [PATCH 1/2] Resolve shell dynamically instead of hardcoding a NixOS store path explicit-shell-file-name was hardcoded to /run/current-system/sw/bin/fish, which doesn't exist off NixOS and isn't even in this package's own Nix closure. The rest of the package wires Nix-provided binaries in via PATH (nix/package.nix's makeWrapper), not baked-in store paths, so resolve the shell the same way: fish if it's on PATH, else $SHELL, else bash, else sh. --- plugins/editor/core.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/editor/core.el b/plugins/editor/core.el index 0e91ba9..656a8e5 100644 --- a/plugins/editor/core.el +++ b/plugins/editor/core.el @@ -41,7 +41,16 @@ (setq ido-everywhere t) ;; Use ido for more completion tasks ;; Changes the way ido displays the completion list (setq ido-decorations (quote ("\n-> " "" "\n " "\n ..." "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]"))) - (setq-default explicit-shell-file-name "/run/current-system/sw/bin/fish") + ;; Nix-provided tools are wired in via PATH (see nix/package.nix's + ;; makeWrapper), not baked-in store paths, so resolve the shell the same + ;; way: prefer fish if it's on PATH (e.g. via extraRuntimeInputs), fall + ;; back to the user's own $SHELL, then a plain sh. Works whether or not + ;; the host is NixOS, and whether or not this is even a Nix-built run. + (setq-default explicit-shell-file-name + (or (executable-find "fish") + (getenv "SHELL") + (executable-find "bash") + "/bin/sh")) ;; Ensures that Emacs inherits the PATH and other environment variables from your shell. (pkg/use exec-path-from-shell From 088df3c76efd9e3e33f6677ba06999007e758353 Mon Sep 17 00:00:00 2001 From: yottanami Date: Sat, 15 Aug 2026 09:07:18 +0200 Subject: [PATCH 2/2] Treat an empty $SHELL as unset in the shell-fallback chain An empty-but-set SHELL= (some minimal/broken login setups do this rather than leaving it unset) is non-nil in elisp, so the previous (or ... (getenv "SHELL") ...) accepted it as-is and skipped the bash/sh fallbacks, leaving explicit-shell-file-name as the empty string. Found by actually running the fallback chain in a real Emacs batch process across all four branches (fish present, normal $SHELL, empty $SHELL, truly unset $SHELL) rather than just reading the code. --- plugins/editor/core.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/editor/core.el b/plugins/editor/core.el index 656a8e5..9da0a98 100644 --- a/plugins/editor/core.el +++ b/plugins/editor/core.el @@ -46,9 +46,14 @@ ;; way: prefer fish if it's on PATH (e.g. via extraRuntimeInputs), fall ;; back to the user's own $SHELL, then a plain sh. Works whether or not ;; the host is NixOS, and whether or not this is even a Nix-built run. + ;; $SHELL is treated as unset when empty: some minimal/broken setups + ;; export SHELL="" rather than leaving it unset, and an empty string is + ;; non-nil in elisp, so a plain (or ... (getenv "SHELL") ...) would + ;; silently accept it and skip the bash/sh fallbacks below. (setq-default explicit-shell-file-name (or (executable-find "fish") - (getenv "SHELL") + (let ((sh (getenv "SHELL"))) + (and sh (not (string-empty-p sh)) sh)) (executable-find "bash") "/bin/sh"))