Hello,
I’m hunting one nasty bug which bother me quite a time.
I have simple shell.nix file:
{ pkgs ? import <nixpkgs> { } }:
pkgs.mkShell {
buildInputs = with pkgs; [
xorg.xclock
];
}
And corresponding .envrc file:
use nix
Problem become, when I try run sudo command with eshell (with envrc installed). In this case it echo some environment variables and exit without other output, example:
eshell> sudo id
SHELL=/gnu/store/49m5357rhckpn7nvvphfv579i3hzpq8w-bash-5.2.37/bin/bash
SANE_CONFIG_DIR=/gnu/store/gs1f6x82wfc170qh191x3xgfbqy74mk9-sane-backends-1.4.0/etc/sane.d
SUDO_GID=998
GTK_IM_MODULE=xim
LSP_USE_PLISTS=true
LINUX_MODULE_DIRECTORY=/run/booted-system/kernel/lib/modules
INSIDE_EMACS=31.0.50,eat,tramp:2.8.2-pre
SUDO_COMMAND=/gnu/store/49m5357rhckpn7nvvphfv579i3hzpq8w-bash-5.2.37/bin/bash -c /bin/sh -i
...
eshell>
Emacs configuration to reproduce this (using elpaca):
(elpaca-test
:interactive t
:keep t
:init
(require 'eshell)
(require 'esh-module)
(require 'em-tramp)
(add-to-list 'eshell-modules-list 'eshell-tramp)
(elpaca envrc
(envrc-global-mode +1))
(add-hook 'elpaca-after-init-hook
(lambda ()
(let ((default-directory "~/bin/"))
(eshell)
(insert "sudo id")
(eshell-send-input)))))))
I tested on Guix, Nix machine, with envrc or direnv Emacs package even with doas instead of sudo result is always the same.
Have anyone a clue what could cause this behavior? Or at least confirm it on own machine?