lorri icon indicating copy to clipboard operation
lorri copied to clipboard

Add a FAQ entry about `shellHook` support to the README

Open Profpatsch opened this issue 4 years ago • 3 comments

We get regular questions and bug reports about shellHooks not being executed (or failing). The lorri direnv setup runs them inside a nix build, not in the final shell like nix-shell does.

We should add an FAQ/Troubleshooting section to the README and explain that and what workarounds exist (e.g. using lorri shell, or adding the hooks to the .envrc instead).

Profpatsch avatar May 04 '20 15:05 Profpatsch

I was affected by this after resolving digital-asset/ghcide#606 today, thanks for taking the time to make an issue so now I know how to fix it :smile:

codygman avatar Jun 04 '20 18:06 codygman

I have the impression this instruction would not be valid: https://github.com/cachix/pre-commit-hooks.nix#direnv--lorri (since - as I understand it - $shellHook still neds be declared, which in turn by spec as in https://github.com/target/lorri/issues/444#issuecomment-652743547 makes the whole build fail, see #444 in general)

UPDATE: https://github.com/cachix/pre-commit-hooks.nix/pull/48

blaggacao avatar Jul 02 '20 02:07 blaggacao

Problem: Lorri can't be used with https://github.com/nix-community/yarn2nix, because a nix-shell for that requires a shellHook like

ln -s ${yarnPkg}/libexec/myModule/node_modules node_modules

such that node_modules in the current directory contains all dependencies. Lorri however can't execute this shellHook with the Nix sandbox enabled, because it doesn't have write access to the projects directory.

Edit: Oops, wrong yarn2nix, edited to the correct one

infinisil avatar Jul 09 '20 14:07 infinisil