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

Remove nixos store paths from .local/share/firenvim/firenvim #1459

Closed
SuperSandro2000 opened this issue Nov 3, 2022 · 3 comments
Closed

Comments

@SuperSandro2000
Copy link

SuperSandro2000 commented Nov 3, 2022

  • OS Version: Windows 11 (Microsoft Windows [Version 10.0.22000.1098]) / NixOS unstable
  • Browser Version: Chrome 106.0.5249.119
  • Browser Addon Version: 0.2.13
  • Neovim Plugin Version: git rev eeaddd0

What I tried to do

Install firenvim.

What happened

The ~/.local/share/firenvim/firenvim script contains store paths which get eventually garbage collected when the system changes enough.

The following PATH elements are problematic:

  • /nix/store/02wg7ljy43i8r2vh2nl3kpv7i4xnswrd-nodejs-18.10.0/bin
  • /nix/store/9cd56ybj4mk4afjsbvpqg8vhlrm8ndv2-universal-ctags-5.9.20220814.0/bin

nodejs and ctags are always in the PATH through the nvim wrapper which lives at /etc/profiles/per-user/sandro/bin/nvim. Why does PATH need to be exported here?

I need to investigate why XDG_DATA_DIRS contains /nix/store/rhqd7ir7c9fnqh5a7mb82v1wbgc2wv3b-desktops/share and is not linked under /run/current-system.

Full contents of the file:

#!/bin/sh
mkdir -p /tmp//firenvim
chmod 700 /tmp//firenvim
cd /tmp//firenvim
export PATH="$PATH:/run/wrappers/bin:/home/sandro/.nix-profile/bin:/etc/profiles/per-user/sandro/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/nix/store/02wg7ljy43i8r2vh2nl3kpv7i4xnswrd-nodejs-18.10.0/bin:/nix/store/9cd56ybj4mk4afjsbvpqg8vhlrm8ndv2-universal-ctags-5.9.20220814.0/bin"
unset NVIM_LISTEN_ADDRESS
if [ -n "$VIM" ] && [ ! -d "$VIM" ]; then
  unset VIM
fi
if [ -n "$VIMRUNTIME" ] && [ ! -d "$VIMRUNTIME" ]; then
  unset VIMRUNTIME
fi
if [ ! -n "$XDG_DATA_HOME" ]; then
  XDG_DATA_HOME='/home/sandro/.local/share'
  export XDG_DATA_HOME
fi
if [ ! -n "$XDG_CONFIG_HOME" ]; then
  XDG_CONFIG_HOME='/home/sandro/.config'
  export XDG_CONFIG_HOME
fi
if [ ! -n "$XDG_STATE_HOME" ]; then
  XDG_STATE_HOME='/home/sandro/.local/state'
  export XDG_STATE_HOME
fi
if [ ! -n "$XDG_DATA_DIRS" ]; then
  XDG_DATA_DIRS='/nix/store/rhqd7ir7c9fnqh5a7mb82v1wbgc2wv3b-desktops/share:/home/sandro/.nix-profile/share:/etc/profiles/per-user/sandro/share:/nix/var/nix/profiles/default/share:/run/current-system/sw/share'
  export XDG_DATA_DIRS
fi
if [ ! -n "$XDG_CONFIG_DIRS" ]; then
  XDG_CONFIG_DIRS='/etc/xdg:/home/sandro/.nix-profile/etc/xdg:/etc/profiles/per-user/sandro/etc/xdg:/nix/var/nix/profiles/default/etc/xdg:/run/current-system/sw/etc/xdg'
  export XDG_CONFIG_DIRS
fi
if [ ! -n "$XDG_CACHE_HOME" ]; then
  XDG_CACHE_HOME='/home/sandro/.cache'
  export XDG_CACHE_HOME
fi

exec '/etc/profiles/per-user/sandro/bin/nvim' --headless --cmd "let g:firenvim_i=[]|let g:firenvim_o=[]|let g:Firenvim_oi={i,d,e->add(g:firenvim_i,d)}|let g:Firenvim_oo={t->add(g:firenvim_o,t)}|let g:firenvim_c=stdioopen({'on_stdin':{i,d,e->g:Firenvim_oi(i,d,e)},'on_print':{t->g:Firenvim_oo(t)}})" --cmd 'let g:started_by_firenvim = v:true' -c 'try|call firenvim#run()|catch|call chansend(g:firenvim_c,["f\n\n\n"..json_encode({"messages":["Your plugin manager did not load the Firenvim plugin for neovim."]+g:firenvim_o,"version":"0.0.0"})])|call chansend(2,["Firenvim not in rtp:"..&rtp])|qall!|endtry'
@glacambre
Copy link
Owner

The following PATH elements are problematic:

Having non-existing directories in your $PATH is not a problem.

Why does PATH need to be exported here?

Because Firenvim users sometimes launch their browsers in a way that results in the environment variables that they rely on in their Neovim config not being set. For example, I've been told that GDM's most recent versions do not load /etc/profile. Another example is people setting their $PATH in their .bashrc/.zshrc.

I need to investigate why XDG_DATA_DIRS contains /nix/store/rhqd7ir7c9fnqh5a7mb82v1wbgc2wv3b-desktops/share

That's because XDG_DATA_DIRS contained this value when you ran firenvim#install(). I'm not familiar with nix, but perhaps you were in a specific nix shell/nix env that set this variable?

glacambre added a commit that referenced this issue Nov 5, 2022
glacambre added a commit that referenced this issue Nov 5, 2022
glacambre added a commit that referenced this issue Nov 5, 2022
@glacambre
Copy link
Owner

I don't think there's anything I can/should do here.

@SuperSandro2000
Copy link
Author

Having non-existing directories in your $PATH is not a problem.

Yes but the nix store paths change when updating the system and if neovim requires them they no longer work but the wrapper should append the right paths anyway. Worst case I just need to regenerate this file when updating which wouldn't be a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants