target / lorri

Your project's nix-env
Apache License 2.0
992 stars 69 forks source link

Bash completions fail because XDG_DATA_DIRS is reset #496

Open roberth opened 3 years ago

roberth commented 3 years ago

Describe the bug

Unlike nix-shell, lorri resets XDG_DATA_DIRS by default, causing user and system commands to fail to autocomplete.

To Reproduce Steps to reproduce the behavior:

  1. use nixpkgs master
  2. use direnv with eval "$(lorri direnv)"
  3. observe that commands from the system or user profile do not support bash completion anymore

Expected behavior

Lorri preserves the host's XDG_DATA_DIRS by default, like nix-shell does.

Workaround

.envrc

HOST_XDG_DATA_DIRS="${XDG_DATA_DIRS:-}"
eval "$(lorri direnv)"
export XDG_DATA_DIRS="${XDG_DATA_DIRS}:${HOST_XDG_DATA_DIRS}"

Perhaps this logic can be built into lorri itself, although it'd be better to figure out why it's cleared in the first place.

Metadata

$ lorri info
lorri version: 1
Lorri Project Configuration

expression: /home/user/h/hercules-ci-agent/shell.nix
$ uname -a
Linux feb 5.9.16 #1-NixOS SMP Mon Dec 21 12:28:21 UTC 2020 x86_64 GNU/Linux

Additional context

stdenv extends XDG_DATA_DIRS as part of its setup.sh script.

jamessewell commented 2 years ago

I'm hitting this as well - workaround works, but would be nice to be built in.