dyuri / xontrib-zoxide

Zoxide integration for xonsh.
MIT License
12 stars 4 forks source link

Caching on a read-only setup #5

Open bestlem opened 6 months ago

bestlem commented 6 months ago

I am trying to use oxide under a nix based system.

The nix build puts the config files in a read-only file system.

Thus on start I get there error

xontrib-zoxide: creating a zoxide init cache file too speed up subsequent loads
xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True
PermissionError: [Errno 13] Permission denied: '/nix/store/8pgrl3sqd1pndwmg2zjx0n7ip5lby2ji-python3-3.11.6-env/lib/python3.11/site-packages/xontrib/zoxide/zoxide_init_cache.py'
Failed to load xontrib zoxide.

Is it possible to create the cache code in the setup phase rather than at run-time - or at least put the files in $XDG_CACHE_HOME

dyuri commented 6 months ago

Yes, it would be definitely possible to use $XDG_CACHE_HOME (if set, if not (for windows/macos) the current location should be fine). PR welcome!

dedguy21 commented 3 months ago

@bestlem I'm new to NixOS and while I've been able to add packages from the xonsh repo (vox and fish_completer) I haven't been able to add xontrib-zoxide without error. Do you mind sharing your script for getting it built accurately 🙏

bestlem commented 3 months ago

@dedguy21 Sorry I did not produce a solution - I just put the code in my initialisation. It is just the code from earlier versions and the zoxide github

execx($(zoxide init xonsh), 'exec', __xonsh__.ctx, filename='zoxide')

I have no idea what the extra code is meant to do so I could not try to use it. The change needs to be explained.

Also you put caches in ~/.cache or ~/Library/Caches and never in ~/.config - thus I have to suspect the quality of the changes as they would never have passed a code review I was involved in.