Closed Zimmi48 closed 3 years ago
Bash checks its completion scripts in $XDG_DATA_DIRS
, and in a recent change in Nixpkgs, it became non-empty in the default pure nix-shell.
$ nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'; nix-shell --pure -p --run 'echo XDG_DATA_DIRS=$XDG_DATA_DIRS'
"21.03pre252388.069f183f16c"
XDG_DATA_DIRS=
$ nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'; nix-shell --pure -p --run 'echo XDG_DATA_DIRS=$XDG_DATA_DIRS'
"21.03pre257780.e9158eca70a"
XDG_DATA_DIRS=/nix/store/i7kr24hdryyvcjj1aag9j8dy0dy8za4a-patchelf-0.12/share
Cached-nix-shell overrides ambient $XDG_DATA_DIRS
with this one instead of prepending to it. It's a limitation of how c-n-s currently works.
As a temporary workaround, I recommend you to run cached-nix-shell
with the --keep XDG_DATA_DIRS
option. E.g.
alias cached-nix-shell='cached-nix-shell --keep XDG_DATA_DIRS'
Thanks a lot for your advice! From my side, the problem is resolved, so should I close this?
Sure, I close it then.
Hi,
I've observed the following problematic difference between
nix-shell
andcached-nix-shell
. In the latter, the autocompletion ofgit
doesn't work while it does in the former.My version of cached-nix-shell is 0.1.4, I've installed both cached-nix-shell and git system-wide with nixpkgs-unstable version
b6bca3d80619f1565ba0ea635b0d38234e41c6bd
, and I've gotprograms.bash.enableCompletion = true
in my NixOS configuration.Thanks in advance for your help!