Closed cumber closed 7 years ago
I agree, this is a problem. I think that using nil
to representing that no sandbox could be found is fine. Accordingly all functions that do not handle nil
gracefully should be changed. I look into it.
@cumber, let me know if this fixed it. Otherwise, please reopen.
@svenkeidel Thanks for the fix; seems to have worked.
The code suggested in the readme for things like getting flycheck to find executables from a nix shell is this:
This works fine even for executables that aren't in the shell, but are in your normal PATH. But when you open a file that isn't in a nix shell,
nix-current-sandbox
returns nil andnix-shell-command
andnix-find-executable
throw an error on receiving nil, even when the executable that's being asked for could be resolved without a nix shell.This makes the suggested code unsuitable for putting as global configuration for flycheck; instead it needs to be activated per project.
I could make the flycheck customisation functions more complex and check whether
nix-current-sandbox
is returning nil, but it'd be much nicer if these functions could instead be no-ops if passed nil (or ifnix-current-sandbox
could indicate that there isn't a current sandbox in some other way). Then the suggested configuration would "just work" more of the time.