Use git+file:// instead of path:// if it’s a git repo. (getFlake is kind of broken in terms of autodetecting a git vs non-git repo, so you really want to provide the actual flake scheme explicitly.)
You probably also want to use --json if you’re going to manipulate the output of nix eval using a script.