I am using Nixos unstable. I tried to remove surplus entries in $PATH (i am using fish) by adding the following to config.fish:
set -U fish_user_paths
fish_add_path /run/current-system/sw/bin
fish_add_path ~/.nix-profile/bin
fish_add_path /etc/profiles/per-user/sperber/bin
fish_add_path /nix/var/nix/profiles/default/bin
This removed the surplus paths and all Paths that i require showed up when entering echo $PATH
. However, it somehow screwed up sudo. It showed the following error:
sudo: /run/current-system/sw/bin/sudo must be owned by uid 0 and have the setuid bit set
Entering crontab -e
yields
cannot chdir(/var/cron), bailing out.
/var/cron: Permission denied
Commenting out the added entries in config.fish didn’t solve the problem so i reinstalled Nixos. However, upon reapplying my configuration.nix
with nixos-rebuild-switch
i have the same errors again. I did nothing other than reapply my configuration.nix
and set the /home directory to its original partition with all my files and .config etc.
So it seems that my changes to config.fish introduced this error and it persists even after removing the added entries.
Checking the owner of sudo: /run/current-system/sw/bin/sudo
yields
lrwxrwxrwx root sudo -> /nix/store/jijfndjmj25xnaaap4c785qq53silj84-sudo-1.9.11p3/bin/sudo
So apparently sudo is still owned by root and something else must be happening. I guess the culprit is fish but i don’t understand it.
This is my config.fish:
if status is-interactive
set -g fish_key_bindings fish_vi_key_bindings
bind -M insert -m default jh repaint-mode
bind -M insert \cc kill-whole-line repaint
bind -M insert \cd forward-char
set -gx EDITOR "emacsclient -nw"
#set -gx VISUAL "emacsclient -c -a ''"
set -g fish_greeting
set -x MANPAGER "sh -c 'col -bx | bat -l man -p'"
# set -U fish_user_paths
# fish_add_path /run/current-system/sw/bin
# fish_add_path ~/.nix-profile/bin
# fish_add_path /etc/profiles/per-user/sperber/bin
# fish_add_path /nix/var/nix/profiles/default/bin
fish_add_path ~/Dokumente/Install/Linux/Skripte
### Hinzugefügt für Emacs
# fish_add_path ~/.npm-global
fish_add_path ~/.npm-global/bin
fish_add_path ~/.config/composer/vendor/bin
fish_add_path ~/.emacs.d/bin
fish_add_path /run/current-system/sw/share/hunspell
end
zoxide init fish | source
navi widget fish | source
How can i solve the problem and what is the reason for it?