Also fixes direnv+flycheck for nix users by consulting direnv before looking for flycheck executables.
By checking on doom-switch-{buffer,window}-hook and focus-in-hook, which fires a lot less often than post-command-hook.