Closed hftsai256 closed 2 months ago
If using an absolute file path is all that's needed then we can do that fairly easily using lib.getExe
.
I believe our defaultEditor
implementation is the same as home-manager's though, so this issue likely isn't exclusive to nixvim.
We'd need to consider if there's any downsides to using an absolute path. I know there's been a push in nixpkgs for desktop entries to rely on PATH, for instance, but maybe that's for unrelated reasons. (https://github.com/NixOS/nixpkgs/issues/308324)
Thanks for the insight. I remember sudoedit
used to work flawlessly about a year ago with home-manager. Things started falling apart months ago but I didn't know there was such a push.
I have a discord thread on this issue but it attracts almost no attention. Maybe I'll override the EDITOR
variable in zsh for now.
N/A
unstable
unstable
Description
By default settings in
/etc/sudoers
, thePATH
is secured and will not pick up the one in~/.nix-profile/bin
; therefore, all the plugins cannot be loaded properly as the wrapping configurations are missing.Minimal, Reproducible Example (MRE)
Run the
sudoedit
command withprograms.nixvim.defaultEditor=true
set in home-manager:I think this is working as expected referring to: https://github.com/nix-community/nixvim/blob/7bda0f1ce49e9da252bcee20b5f700e6dcd3cf8d/wrappers/hm.nix#L62
However, this wouldn't work because the
PATH
is restricted in/etc/sudoers
. An easy workaround is to export (override) theEDITOR
variable:I may also override it in my zsh config:
but I think this defeats the purpose of setting the
nixvim.defaultEditor
attribute.Or I would have to edit
/etc/sudoers
to modifysecure_path
, which I don't think is a good idea.BTW the
neovim
module from home-manager has the same issue. What is the best practice to handle this use case?