Resolve shell dynamically instead of hardcoding a NixOS store path - #1
Open
yottanami wants to merge 2 commits into
Open
Resolve shell dynamically instead of hardcoding a NixOS store path#1yottanami wants to merge 2 commits into
yottanami wants to merge 2 commits into
Conversation
Owner
Author
|
Reviewed. The change itself looks correct and well-scoped:
That said, this is held rather than merged: no agent has |
3 tasks
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.
yottanami
force-pushed
the
agent/18-fish-shell-path
branch
from
July 29, 2026 11:58
c1b0883 to
2208a70
Compare
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
explicit-shell-file-namewas hardcoded to/run/current-system/sw/bin/fishinplugins/editor/core.el, a NixOS-only path, andfishisn't even in this package's own Nix closure (nix/package.nix'sruntimeTools). BreaksM-x shellon any non-NixOS system, including a plainnix runelsewhere.The rest of the package wires Nix-provided binaries in via
PATH(nix/package.nix'smakeWrapper+--prefix PATH), not baked-in store paths, so this resolves the shell the same idiomatic way instead of hardcoding a different path: preferfishif it's actually onPATH(e.g. if someone adds it viaextraRuntimeInputs), fall back to$SHELL(treating an empty-but-set$SHELLas unset, since that's non-nil/truthy in elisp), thenbash, then/bin/sh.Notes
Nix and Emacs are both available in this environment now, so this was actually run, not just read.
Test plan
nix flake check --no-build: all checks pass.nix build .#noteditor: builds clean../result/bin/noteditor --batchand printedexplicit-shell-file-nameafter init: resolves to/bin/bash, matching this environment's$SHELL. Confirms the fix works in the actual packaged product, not just an isolated snippet.(or (executable-find "fish") ...)fallback chain in a realemacs --batchprocess across all four branches:fishonPATH-> resolves to the fish store path.$SHELLset, no fish -> resolves to$SHELL.$SHELL=""(empty but set), no fish -> resolves tobashviaexecutable-find(this caught a real bug in the first version of this fix: an empty string is non-nil in elisp, so a plain(getenv "SHELL")in theorchain accepted""and skipped thebash/shfallbacks entirely, leavingexplicit-shell-file-nameempty; fixed by treating empty as unset).$SHELLtruly unset, no fish -> resolves tobashviaexecutable-find.grep -rn "/run/current-system" --include="*.el" .: no hardcoded NixOS store paths remain anywhere in the elisp tree.Closes Men-in-Black-5/ideas#18