builtins.getFlake breaks if git core.fsmonitor is enabled

I was setting up nixd as an LSP for nix, and for flakes it needs to get the path to a flake passing it to builtins.getFlake. It was not working so I was debugging in the repl and I saw this.

$ nix repl .
Nix 2.24.9
Type :? for help.
warning: Git tree '/Users/ahmedelgabri/.dotfiles' is dirty
Loading installable 'git+file:///Users/ahmedelgabri/.dotfiles#'...
Added 5 variables.
nix-repl> (builtins.getFlake "/Users/ahmedelgabri/.dotfiles")
error (ignored): error: end of string reached
error:
       … while calling the 'getFlake' builtin
         at «string»:1:2:
            1| (builtins.getFlake "/Users/ahmedelgabri/.dotfiles")
             |  ^

       … while fetching the input 'path:/Users/ahmedelgabri/.dotfiles'

       error: file '/Users/ahmedelgabri/.dotfiles/.git/fsmonitor--daemon.ipc' has an unsupported type

fsmonitor-daemon is managed by git core.fsmonitor feature Git - git-fsmonitor--daemon Documentation

So I was wondering if there are workarounds regarding this limitation other than disabling fsmonitor and removing the file?

1 Like

I have an open issue on a similar problem. `path:` flake reference has some weird behavior · Issue #11567 · NixOS/nix · GitHub

2 Likes

I experienced the same issue.

error (ignored): error: end of string reached
error:
       … while fetching the input 'path:~/.config/home-manager'

       error: file '~/.config/home-manager/.git/fsmonitor--daemon.ipc' has an unsupported type

Commented out all fsmonitor lines. And, force delete the shown file paths with * wildcard.

sudo rm -v ~/.config/home-manager/.git/fsmonitor--daemon.ipc*

Note the * at the end of *.ipc* because it has an extra ~/.config/home-manager/.git/fsmonitor--daemon.ip= on my machine.

But, at this stage, I cannot enable all fsmonitor lines as it the original problems will appear again.

Does anyone know how to fix this issue with fsmonitor enabled?