Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shell aliases cause error messages in nix-shell -p pkgs.wrapGAppsHook #8238

Open
epithet opened this issue Apr 18, 2023 · 0 comments
Open

shell aliases cause error messages in nix-shell -p pkgs.wrapGAppsHook #8238

epithet opened this issue Apr 18, 2023 · 0 comments
Labels

Comments

@epithet
Copy link

epithet commented Apr 18, 2023

Describe the bug

I have the following alias in my .bashrc:

alias ls="lsd --color=auto"

I get the following error message "The program 'lsd' is not in your PATH" when starting a nix-shell with pkgs.wrapGAppsHook.

I get the error message one more time with xfce.xfconf in conjunction with pkgs.wrapGAppsHook.
But no error message with xfce.catfish on its own.

This also happens with the following shell.nix:

{ pkgs ? import <nixpkgs> {} }:
let inherit (pkgs) mkShell; in
mkShell {
  name = "dev-shell";
  buildInputs = with pkgs; [
    wrapGAppsHook
    xfce.catfish
  ];
}

I have not yet seen any subsequent errors because of this, but it seems that some logic is not executed correctly while making the packages available.

Once the shell is started, lsd is on my PATH and the alias works as intended.

I don't get any error messages with nix-shell --pure -p pkgs.wrapGAppsHook.

I suspect nix-shell sources .bashrc too early or in a context where it doesn't make sense during some hook evaluation. Otherwise I would have reported this bug in the nixpkgs repo. Please correct me if I'm wrong.

I should add that I don't know if it actually makes sense to include this hook in my shell.nix. I did it because it is in the nativeBuildInputs of catfish nixpkg, which I wanted to compile myself. But if such hooks don't make sense in a nix-shell, another error message should be produced.

Steps To Reproduce

$ nix-env -iA nixos.lsd

$ echo 'alias ls="lsd --color=auto"' >>~/.bashrc

$ nix-shell -p pkgs.wrapGAppsHook
Hi from .bashrc
The program 'lsd' is not in your PATH. You can make it available in an
ephemeral shell by typing:
  nix-shell -p lsd
The program 'lsd' is not in your PATH. You can make it available in an
ephemeral shell by typing:
  nix-shell -p lsd

nix-shell$ ls --version
lsd 0.23.1

Expected behavior

No error messages.

Additional context

$ nix-env --version
nix-env (Nix) 2.11.1
@epithet epithet added the bug label Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant