I have the following setup:
home-configuration.scm
(services
(append (list (service home-bash-service-type
(home-bash-configuration
(aliases '(("sudo" . "sudo ")
...
("vim" . "nvim")
(service home-fish-service-type
(home-fish-configuration
(aliases '(("sudo" . "sudo ")
...
("vim" . "nvim")
This causes vim and sudo vim to work for bash and vim for fish including when logging as root user via su, but unfortunately sudo vim does not work using fish.
> sudo vim
sudo: vim: command not found
What could be the cause?
You should diff the various environments with those aliases I posted on the other thread.
- bash: env and sudo env
- fish: env and sudo env
- bash and fish
It’s likely you have something in your .bash_profile (or .profile) which isn’t being set up for fish.
Also, your window manager will set up a profile when it loads. Sometimes you need to login & logout. The Guix home container should show updates.
This is all a bit confusing when setting it up for yourself in Arch (from scratch), NixOS or Guix.
I haven’t used fish, so I’m not 100% sure.
Again, check sudo env | grep -e ‘^PATH’ | tr ‘:’ ‘\n’ from within fish. Or use alias. Or whatever command works in fish
Sudo has some environment differences. So it can’t find vim in PATH
Checking the envs I’ve noticed that all the PATHs are the same.
On top of that I’ve (re-)discovered that all aliases are not working.
> df
Filesystem Size Used Avail Use% Mounted on
none 18G 0 18G 0% /dev
...
> sudo df
Filesystem 1K-blocks Used Available Use% Mounted on
none 18250332 0 18250332 0% /dev
...
> bash
$ df
Filesystem Size Used Avail Use% Mounted on
none 18G 0 18G 0% /dev
...
$ sudo df
Filesystem Size Used Avail Use% Mounted on
none 18G 0 18G 0% /dev
...
home-configuration.scm
services
(append (list (service home-bash-service-type
(home-bash-configuration
(aliases '(("sudo" . "sudo ")
...
("df" . "df -h")
(service home-fish-service-type
(home-fish-configuration
(aliases '(("sudo" . "sudo ")
...
("df" . "df -h")