Running sudo and doas without specifying /run/wrappers/bin

I’m very new to NixOS so go easy on me, but I’m a little confused. A few hours after I had been messing around with my new installation, sudo suddenly broke on me. I did a lot of research and found this excellent post which said the wrapped executables were there, and sure enough they were. However, even after I did security.sudo.enable = true; or even security.doas.enable = true; (when I thought sudo might be the culprit), they still wouldn’t be added to my path. I know that I can just add /run/wrappers/bin to my path and not worry about it, but I can’t shake the feeling I’m doing something wrong here.

in my not so messed up NixOS the /run/wrapper/bin path you mention, is by default included, it seems you lost it somehow…? some option you used in configuration.nix?

[jane@nixos:~]$ whereis sudo
sudo: /run/wrappers/wrappers.OJYvJ2yTQA/sudo /nix/store/ijav91927wmqjbqwhlacdr7sarn78azp-system-path/bin/sudo

[jane@nixos:~]$ echo $PATH
/run/wrappers/bin:/home/jane/.nix-profile/bin:/etc/profiles/per-user/jane/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin

[jane@nixos:~]$ sudo
usage: sudo -h | -K | -k | -V
usage: sudo -v [-ABknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-ABknS] [-g group] [-h host] [-p prompt] [-U user] [-u user] [command]
usage: sudo [-ABbEHknPS] [-C num] [-D directory] [-g group] [-h host] [-p prompt] [-R directory] [-T timeout] [-u user] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-ABknS] [-C num] [-D directory] [-g group] [-h host] [-p prompt] [-R directory] [-T timeout] [-u user] file ...

and the sudo user has to be in the group “wheel”

1 Like

Hello, yes you’re right! I was adding a different directory to my path in my bashrc, and accidentally overwrote the entire path. Thanks for your quick response!

1 Like